Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I need to do the following

Create a site workflow that will:

  • Check the folder creation date in a document library
  • If the folder is older than 30 days, move the folder somewhere.

Questions:

  1. Can I make a workflow that every day checks for the creation dates of all folders and then do what is needed?
  2. Is it possible to iterate through all folders within SP Designer every day and do something?
share|improve this question

3 Answers 3

up vote 3 down vote accepted

I wouldn't bother about iterating through all folders. How about attaching to each new folder a workflow that will pause for 30 days then move the folder?

share|improve this answer
    
how can I attach a workflow to a folder? –  Esteban V Mar 19 '12 at 20:55
    
this is a nice idea, my first workflow will create the folder, then another workflow attached to the shared documents, and will execute only when its created. I think I will give it a try –  Esteban V Mar 19 '12 at 21:06
    
Let us know how it goes! Blue Murphy responded to your first comment, you could create your own folder content type. –  Christophe Mar 19 '12 at 22:48

No looping in SPD. You can create a reuseable workflow and associate it to a custom content type that inherits from the folder content type. There is an a Pause for duration action that you can set for 30 days. Then you can have your logic do what you want.

share|improve this answer
    
No looping within a workflow. but you can create a loop by having a workflow trigger itself or trigger a twin workflow. –  Christophe Mar 19 '12 at 22:46
    
Keep in mind Christophe the point of looping in this scenario is to go through a set of data, not to repeat a task. While your right that you can do that, it doesn't help here. –  Zork Mar 20 '12 at 12:45
    
@Zork you can do looping through a set of data, with a worflow (or a pair of workflows) hosted in a separate list. I usually do this from an item that includes a counter. –  Christophe Mar 24 '12 at 3:58

Correct me if I'm wrong, but you cannot move a folder with its containing documents without moving those same documents first.

Furthermore since SPD does not let you loop, you could not accomplish this task using it.

In order to accomplish this with the assumption that there may be documents within those folders, you could create a Visual Studio Coded Workflow to attach to your list.

For this purposes of this explanation I will assume you will not have nested folders...

  1. Pause for 30 days
  2. Add an 'if' block to check if the current item is a folder
  3. Create a folder with the same name as current item in the target document library
  4. Loop through all items contained within this folder
    1. Copy Document to target document library folder
    2. Delete Document in current folder
  5. Delete current item

If you want to go this route and need code samples, let me know and I would be happy to supply.

share|improve this answer
    
Can I attach a workflow in SP Designer that will execute when a new folder is created, then the first step it will do, is pause for 30 days, after the 30 days, execute a custom action that will move the files and folders? –  Esteban V Mar 19 '12 at 21:15
    
The first part you can do fine, but SPD does not support executing custom code. Keep in mind the point of SPD is to give more advanced options to those who don't want to create a coded solution. In order to do that without having special permissions everywhere, they have to lock down the flexibility of it. –  Zork Mar 20 '12 at 12:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.