Sharepoint Designer 2010 subfolder workflow in 11 simple steps

[ProjectCasemanagement solution]

As a follow-up on my previous post, I’ve decided to make a short video demonstrating how to create a better solution. I still use the same method, but I’ve added some functions that makes it semi-dynamic. I say semi-dynamic because you’re still hardcoding the number of subfolders you want. It’s only the names of the folders that’s dynamically. While

making the video I thought about how to make this fully dynamic with a dynamic number of folders as well as dynamic folder-titles. To the best of my knowledge it would require a way for the SharePoint Designer Workflow to loop through all items in a list and for each item, create a subfolder. SharePoint Designer Workflows, just aren’t that smart. so we have to settle for semi-dynamic. You could go nuts and create a workflow that listens to 30-50 items in a list. Then you should be on the safe side of crazy users trying to implement some wicked nightmare of a folder-structure.

[embedplusvideo height=”393″ width=”650″ standard=”″ vars=”ytid=7-7kqdCA1ys&width=650&height=393&start=&stop=&rs=w&hd=0&autoplay=0&react=1&chapters=&notes=” id=”ep2656″ /]

Whats up next?

The first question a asked myself, after finishing the screen cast was, “What if I want to add another level of folders, so I have 3 levels, and still keeping the semi-dynamic functionality”?

Answer: I will get back to you… that’s little harder, but should be possible.

Here is how you do it in 11 simple steps (Or watch the video)

  1. Create a custom list
    • Listname: Projects
    • Type: Custom list
    • Columns: Title (Default), Project documents (Hyperlink)
  2. Create a custom list
    • Listname: FolderList
    • Type: Custom List
    • Columns: Title (Default)
  3. Create a document library
    • Listname: Shared Documents
    • Type: Document Library
    • Columns: The usual suspects (Just create a standard one)
  4. Open SharePoint Designer and create a list-workflow, based on the “Projects” list.
  5. Create 4 workflow steps
    • Step 1: Create Variables
    • Step 2: Create Rootfolders
    • Step 3: Create Subfolders
    • Step 4: Create link to documents
  6. Create Variables
    • Command: Set Workflow Variable (VRootFolder to [Current Item: Title]]
    • Command: Set Workflow Variable (VSubfolder1 to [Folderlist:Title, where ID=1])
    • Command: Set Workflow Variable (VSubfolder2 to [Folderlist:Title, where ID=2])
    • Command: Set Workflow Variable (VSubfolder3 to [Folderlist:Title, where ID=3])
    • Command: Set Workflow Variable (VSubfolder4 to [Folderlist:Title, where ID=4])
    • Command: Set Workflow Variable (VSubfolder5 to [Folderlist:Title, where ID=5])
    • Command: Set Workflow Variable (VLinkToDocs to[%Variable:VRootFolder%], Project documents)
  7. Create Rootfolder
    • Command: Create ListItem
      • List: Shared Documents
      • Add: Content Type ID (Value: Folder)
      • Modify: Path and Name (Value: [%Variable:VRootFolder%])
  8. Create Subfolders
    • Command: Create ListItem
      • List: Shared Documents
      • Add: Content Type ID (Value: Folder)
      • Modify: Path and Name (Value: [%Variable:VRootFolder%]/[%Variable:VSubFolder1%])
    • Command: Create ListItem
      • List: Shared Documents
      • Add: Content Type ID (Value: Folder)
      • Modify: Path and Name (Value: [%Variable:VRootFolder%]/[%Variable:VSubFolder2%])
    • Command: Create ListItem
      • List: Shared Documents
      • Add: Content Type ID (Value: Folder)
      • Modify: Path and Name (Value: [%Variable:VRootFolder%]/[%Variable:VSubFolder2%])
    • Command: Create ListItem
      • List: Shared Documents
      • Add: Content Type ID (Value: Folder)
      • Modify: Path and Name (Value: [%Variable:VRootFolder%]/[%Variable:VSubFolder2%])
    • Command: Create ListItem
      • List: Shared Documents
      • Add: Content Type ID (Value: Folder)
      • Modify: Path and Name (Value: [%Variable:VRootFolder%]/[%Variable:VSubFolder2%])
  9. Create link to projectfolder
    • Update ListItem
      • List: Current
      • Item: Current
      • Add: Project documents (Value: [%Variable: VLinkToDocs%])
  10. In setting for the workflow, set it to run when a new item is created
  11. Publish the workflow, and test it out.


26 thoughts on “Sharepoint Designer 2010 subfolder workflow in 11 simple steps”

  1. Thank you so much for your great tutorial! I was able to set all the variables and rootfolder but have not yet been able to create subfolders. I have read your tutorial at least 10 times and have reviewed my logic on SPD 2010 but cannot figure out what the probem is (its obvious that I’m not doing something right!). Can you help me?

    • @Phil: Sorry for the late reply. I’m in the midst of my paternity leave, so I’ve been a little absent the last few weeks. I would like to give you a helping hand, by taking a look at what you’ve done. I will contact you at the e-mail you’ve given me.

  2. Hello Ulrich,
    I thought this was brilliant, just what I needed and I adapted it to create folders and document sets. All worked apart from the ‘content types available to this document set have been removed’ error and the document set is empty. Have you ever come across a totally SPD solution to that?

    • @Jackie: I haven’t tried to use this solution, with document sets. If you find a solution, please post it in the comment section or send me an e-mail. I will try and find time to test it out with document sets.

  3. Hi thank you so much for your valuable post. I am able to create sub folder under document library. I have a requirement to move the documents from one document library to another document library.
    Source Library – DocumentLib
    Destination Library – Archive
    Archive document library will have folders by fiscal year.
    Source documentlibrary has files from year 2012 till date.
    Archive folder will have folders by fiscal year -(fiscal year starts from July1st -June 30th )
    If the document is created date between 1st July 2012 -June 2013 then move the document to Archive document library and in folder Fiscal Year 2013.
    If the document is created date between 1st July 2013 -June 2014 then move the document to Archive document library and in folder Fiscal Year 2014.

    The structure of destination document library folder should be same as source document library.

    Please find attached the screenshot of the requirement.

    Files Type – Excel,pdf,microsoft outlook item

    Could we use Sharepoint designer workflow to achive this task?
    Any help on this will be appreaciated.
    please refer this for more details.

  4. Ulrich,

    i’m very interested in using what you have here for creating folders.

    Can you tell me if what you’ve put together can be modified to do the following?

    First, the background. i have a doclib and a list, and they are not linked in any way. The project folders (Supplier names, actually) are created manually by me. There’s a ‘service’ folder that is also created by me, within the Supplier name. and there can be many service folders. 1 Supplier provides many services, thus a 1-to-many relationship for that. When a service folder is created, that’s when i want to use your routine.

    When a ‘service’ directory is created, i’m wanting a routine like what you have here, based on certain check boxes checked within the list, to do the following:

    – create a 2013, and 2014 folder for the service,
    – then create either months, quarters, or whatever else folders based on what’s checked in the list.

    Now for my question – Can that be done with that you have here? Have you done that before?

    We have many many suppliers and i find that i spend a lot of my time using windows explorer to copy static folders (pre-created) within another folder to the service folders, which takes quite a bit of time. Your solution would obviate the need for me to even open explorer, not to mention the time savings, which in my mind would be quite significant.

    Very much welcome your response Ulrich.

    Noppo in Tokyo

    • Hi Noppo

      You can use my method/rutine for the task you are describing. If you are on a SharePoint 2013 box, it’s alot easier, because workflows in sharePoint 2013 can loop.

      On a SP 2010 box you need to use a lot of “If condition is true….. Create this folder” steps in your workflow.

      Depending on your list of folders and checkboxes, I would estimate that I could build the workflow on around 5 hours. I need some more details naturally, but it’s doable.


  5. Just to be clear, the extra folders would be placed WITHIN the 2013 & 2014 folders, and not at the same level as the 2013/2014 folders. My original note didn’t make that clear. Thank you!

  6. Very sorry. It appears that my original message didn’t take. i will have to leave it again when i have more time. Apologies.

  7. Brilliant! Thanks I was looking for a way to add folders to a doc library w/SPD and you showed me how!!

  8. Hello Ulrich, Thank you so much for this guide, it worked great for me.
    Since folders are created automatically with workflow, is there any way workflow can check if the root-folder already exists before creating one? I tried using IF statement but can’t wrap my brain around it. Your help will be much appreciated.

  9. Thank you so much for posting- the automation of folder creation is exactly what I was looking for. In the Create Link to Documents step, I want to link back to the folder I just created (single folder scenario).

    Is this possible? In your solution, the link back just goes to the library root. Can a variable be arrived at that gives me the direct URL/path into the brand-new folder?

  10. Ulrich, this post saved me so much time! Thank you!

    I’m having on problem. The string being passed over as the folder name is sometimes so long that it causes an error when the workflow goes to create the link. It seems to break anytime the string is more than 45 characters including spaces. Is there something I’m missing? Or is there a possible workaround?

  11. Hi Ulrich,
    How do you acheive this if you want to create sub folders in document library when you create a root folder in the same document library.
    The catch is this that you do not know what the root folder name is going to be. But we know the names of the subfolder.
    We also do not know where the root folder is going to be created in the document library.
    Any input would help.
    Thank you

  12. Hi I know time has gone on a bit but can you please point me to the video as it does nor appear on the site anymore




Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.