Expiration Policy workarounds


We had a requirement for which we needed to hook up an alert with the document library that would fire at some point in time. The scenario was to have a capability to have a repository in which contracts could be stored and mails sent out to the contract management group a month or so before the contract expires. This scenario should also accommodate for open ended contracts that are basically created one time but gets auto renewed every year until someone decides to stop the contract.
We decided to handle this making use of the expiry policy features in MOSS. So we went and created a documet library that had fields start date, end date and Auto Upgrade which was a choice field (Yes/No) and decided to fire up a workflow one month before the end date that would send off an email to a set of users informing them that the contract was about to expire. The workflow would update the start and end date in case the Auto Upgrade option was set to yes.
MOSS only allows us to define the retention period as a date field + a period.  There is no option to specify EndDate – 1 month (Before you ask, MOSS does not allow you to give a negative number in the period field) . So that would be OK if all my contracts were of a fixed duration, however that was not what we had. There was an option to set the expiration date programatically and it gave in brackets by a workflow. Switching over to SharePoint designer workflow I looked for a field called expiration date, however it was not present. So we wrote a event and hooked it up with the document library to update the expiration date once a document was uploaded. We then created the workflow in SharePoint Designer so that the user could add in stuff without calling for us. One additional step we had to do was to  create a custom activity to update the expiration date for the auto upgrade case since the field is not present in Designer

6 comments

  1. Why not create a calculated field which stores the “End Date – 1 month” value

    Then you can use that as your target field for your Expiration Policy ?

  2. Is there a way to specify a field as a target for the expiration policy? I was not aware of it and assumed that sharepoint took only its internal expiry date to trigger off the expiration process.

  3. Dear Jackson,

    For the same requirement I want to create and deploy the custom policy for document libraries. Pls let me know how you achieved this in detail. If possible pls share source code, if any. Its bit urgent for me pls reply me aeap.

    Thanks in advance.

  4. Robert Moses · · Reply

    I solved this by using a policy testing the notification date. I created a hidden field of expiration date – 42 days (6 weeks prior) to kick off a notification email.

  5. Lee Morgan · · Reply

    For anyone still having issues with this – you can specify which the ‘target’ by adding a date/time column to the library…..then when you then define the policy you will see the new column in the ‘A time period based on the item’s properties:’ dropdown (OOTB you only get created and modified columns to choose from).

    The date/time column you add to the library could indeed be a calculated column as specified above by Robert Moses.

  6. My requirement is similar to yours , but change was that i need to move the document on the expairy date to the user recycle bin. (by default retention policy will move the document to the site recycle bin – only site collection admin will have access to it.) so in the work flow i ran the code in the authors impersination and was move to the users recycle bin.
    But the problem I am facing is work flow is not invoked by the retentention job, I had associated the workflow to the content type in the hub and again re-associated in the subscribed site. Like to know why the workflow is not initiating by the retention job?

Leave a reply to Martin Hatch Cancel reply