Monday 3 October 2011

Expire Items\Documents in Folders using Views in SharePoint


Few days back, I had a requirenment to implement a expiration process for documents in specific folders where the expiration period for different folders is different.

For example A Folder named Quaterly will have documents that will expire (be out the view) after three months of when they are uploaded. Where as a Folder named Yearly will have documents that will expire after one year of when they are uploaded.

To implement this I have used Folders,Calculated columns and Views.

Summary of Steps -
We will create two views one for Quaterly documents and other for Yearly documents.
Both these views will be filtered with Quaterly Expiration Date column and Yearly Expiration Date column respectively. These Quaterly and Yearly Expiration Date columns are calculated columns which wil contain the expiration dates for each document according to the created date of teh documents.

Lets see the Steps -

1. Create two folders "Quaterly" and "Yearly".
2. Create a new Custom column "Posted Date". This column should be Date and time type set to "Date" only and set to Today as default.
3. Create two new calculated columns Quaterly Expiration Date and Yearly expiration Date.
Quaterly Expiration Date -
=IF([Content Type]="Folder",Created+5000,[Posted Date]+90)

Yearly Expiration Date -
=IF([Content Type]="Folder","",[Posted Date]+365)

4. Next, we will create the required views. Click on Quaterly folder and then Click on Create View.

5. Create a New View with columns Posted Date and Quaterly Expiration Date and then Filter it with the following values -

Quaterly Expiration Date
is greater than or equal to Today
[Today]
Click Ok.

6. Next, click on Yearly folder and Create a New View with columns Posted Date and Yearly Expiration Date and then Filter it with the following values -

Yearly Expiration Date
is greater than or equal to Today
[Today]
Click Ok.

7. Now create a new Page with a two links "Quaterly" and "Yearly". Click on the Folders "Quaterly" and "Yearly" and copy the url for the Folders when there respective views were selected. Assign the "Quaterly" and "Yearly" links to the above links that you created.

Ads by Google

No comments:

Post a Comment