Delete Files with Workflow Using Duration

This is just a quick little tidbit.  Out-of-Box workflows in MOSS, unless manually kicked off, require an event to be triggered.  I was trying to figure out a way to automatically delete files from a document library 3 days after they were uploaded.  The doc library was being used strictly as a transfer point and needed to be kept clean.  Thanks to Sean S. for the idea…

So as simple as it is:

1.       Start a new workflow using SharePoint Designer by going to File -> New -> Workflow.

2.       Give the Workflow a name and select the target doc library or list.

3.       Set the start event.  I set mine to automatically start when the item is created or changed.  Click Next.

4.       Enter a name for Step 1 such as `Pause for 3 days’

5.       Do not select a condition because we want it applied to all items.

6.       Under Actions select `Pause for duration’.

7.       Change to 3 days, 0 hours, and 0 minutes.

8.       On the right choose to `Add workflow step’

9.       Once again, give the step a name and no condition.

10.   Select Delete Item under Actions and set it to Current Item.

11.   Click Finish to save the workflow.

NOTE: A good way to test this first is to set the duration to a low count like 1 minute.  Once you are sure it works properly, set it to your desired time frame.

One Response to “Delete Files with Workflow Using Duration”

  1. Bryan says:

    Excellent post. Thank you.

Leave a Reply