Some time back I implemented interesting functionality which is the topic of this article.
Requirements:
The client wanted to have override feature where users can override expiration date and it should be configurable meaning user can specify number of days/months/years to extend current expiry date. Fortunately we had implemented Custom Expiration formula to calculate expiry date which helps in designing solution for this requirement.
Assumptions:
Assumptions:
You are using Custom Expiration formula to calculate expiry date.
Solution:
Solution:
I took following steps to implement the solution.
Part of aspx file where all controls are defined.
Feature.xml
Here are screenshots of final product.
- Create new hidden field "Ignore" of type Number in document library.
- Create new .aspx page and code behind files. You will find several articles on internet on how to create new application page.
Part of button click event handler
- Create feature xml file to provision .aspx file and add "Override Expiration" menu to ECB (Editor Control Block) of list item.
Feature.xml
- Modify custom expiration formula code to return already set expiration date when "Ignore" field contains value "1".
- Build solution (WSP) and deploy to your SharePoint farm.
Here are screenshots of final product.
List item with "Override Expiration" ECB menu item and current "Expiration Date"
Screen to capture user inputs (expiry date to extend by 3 days)
List item with updated "Expiration Date"
Attachment:
OverrideExpirationECBMenu.zip
Note the project I have attached is actually taken from proof of concept, so there are no validation and exception handling implemented.
Leave comments if you have any question.
Hope this helps.
-Javed