Creating folders and sub-folders using SharePoint 2010 Designer Workflow

[[UPDATE: This is now part of a series of posts, where I show how to build a simple project/case management solution, with a no-code approach, using SharePoint 2010 Designer Workflows. Check out my other posts to learn more.]]

[ProjectCasemanagement solution]


I have a list with names of projects. Whenever I create a new item on my list, I want the SharePoint 2010 Designer Workflow to create a folder for the project and several subfolder beneath the projectfolder. I’m using Office 365 as my platform, so there is a no-code requirement. In this case I want the rot-folder to be named “Title (ListID)”.

Listname: List A
Libraryname: DocLib

Solution: Enter the SharePoint 2010 Designer Workflow

  1. Create a SharePoint list workflow in List A
  2. Set workflow to start automatically upon new item
  3. Create a step to name variables (Looks nice and makes it easier to edit later on – optional)
  4. Create variable Vcase and set the value to [%Current Item:  Title%] ([%Current Item:Id%])
  5. Create variable Vsubfolder1 and set the value to Subfolder 1 (Optional but makes it easier to edit later on)
  6. Create a step to create new element (This is the root folder)
    1. Select “DocLib” as list to create item in
    2. Select “Action – Create listelement”
    3. Add “Id for contenttype” – set in to Folder
    4. Edit “Path and name (*)” – set it to [%Variable:Vcase%]
  7. Create a step to create new element (This is the subfolder)
    1. Select “DocLib” as list to create item in
    2. Select “Action – Create listelement”
    3. Add “Id for contenttype” – set in to Folder
    4. Edit “Path and name (*)” – set it to [%Variable:Vcase%]/[%Variable:Vsubfolder1 %]
  8. Repeat step 5 and 7 for each subfolder you wish to create.

I’ve tried this method on SharePoint Online (Office 365), with 1 root-folder and 3 sub-folders. I then created 100 lines in “List A” and waited 2 minutes for the folders to be created. Worked perfectly.

[Office 365]

Tweet me

  • Creating folders and sub-folders using SharePoint 2010 Designer Workflow – Click to tweet
  • I just learned how to create automatic folders and subfolders in SharePoint – Click to tweet
  • Check out how to create folders using nothing but SharePoint Designer and no code – Click to tweet

30 thoughts on “Creating folders and sub-folders using SharePoint 2010 Designer Workflow”

  1. can you explain this using the snapshots? I tried the way you suggested but it didnt work. so please help

  2. Trying to follow the video and i’m stuck in Create RootFolder step. When I add the ‘Create New List Item’ selected Shared documents, Add ‘Content Type ID’ under Value Assignment, the drop down for ‘To this value” doesn’t have any options. it’s blank. no folder option at all. HELP!

    • Hi Karen

      It is a bit tricky to give an exact solution. But I have a few things you could try:

      1. Try and create a new Document Library
      2. Try deleting your SharePoint Local cache by deleting the content of these two folders:
        • %APPDATA%MicrosoftWeb Server ExtensionsCache
        • %USERPROFILE%AppDataLocalMicrosoftWebsiteCache
      3. Check your Rights (Unlikely though)

      If all else fails, ping me again and we will figure something out.

  3. HI Ulrich, thanks for your post – this is exactly what I want to achieve. I am a beginner with SharePoint, so I am sure I have overlooked something really simple. I created this workflow on my sharepoint site and it worked perfectly. I have created the same workflow on a new site and it doesn’t work at all. It starts and then sits on the “creating variables” stage and doesn’t progress. I’ve double and triple checked everything – I’ve even tried creating different lists and setting up a workflow on that and it fails with the same symptom. Any help you could provide would be appreciated.

    • Hi Ged

      Are you using SP 2010 or SP2013 workflows, since you use the phrase “Stage”? I haven’t tested this on a 2013, allthough it should work. The typical pitfall is setting the content-type to folder. That is very important.

      Allso, try setting some Logging in between your actions. That should give you a hint as to where the workflow stops.

      Hope it helps. 🙂 Otherwise keep commenting and I will se if I can help you out.

  4. Hi! I am trying to use SharePoint Designer 2010 to create a set of sub folders for SharePoint with Dynamic CRM 2013/ Online. At Step 1. When I create the list… Nothing happens. Not sure if CRM online has anything to do with it. Suggestions?

    • Hi Justin

      You need to create a “List-workflow” in step 1. Not a workflow that creates a list. I can see how that can be misunderstood. CRM Online should not have any impact on creating workflows.

      Hope it helps. If you still experience issues, please post another comment and I will try to help you out.

  5. Hi, ulrich,
    can you create folder inside sub sub folder (so this is the structure, 1. title, 1.1 title, 1.1.1 title, so there is 4 level) when i try to 3 lvl it’s fine, (like your tutorial) but when i try the 4th, it’s getting error “workflow could not create the list item…”, any idea? and when i tried to change from folder to Link to a Document, it’s getting error too.
    Sorry for my poor language

    • The only thing I can think of, at the top of my head, is that it could be a 255 character limitation. Is your titles simple and short?

      Remember that level 4 cannot be created before level 3 is complete. A no-brainer, I know, but I have to mention it anyway..

      I have not head of, or experienced, any limitations in the actual number of levels. It will never work, if you use “document” as a contenttype. It has to be “Folder”. Are you 100% sure that you have spelled the first 3 levels correctly?

      If I get time, I will test this and get back to you, but don’t bet on it being any time soon. 🙂

      • URL length limit in browsers is 260 characters. A space in a name is equal to 3 characters. SharePoint sees the entire path to the file as the file name, everything from the http://to the file suffix. When nesting folders it’s very easy to hit the file size limit.

  6. Hi Ulrich,

    Very good, but I am having difficulty emulating you. I am using a document set instead of a folder on Office 365 instead of on premise SharePoint. I can create the document set and the document in the target library. I can also use the second workflow to place the document in the set manually, but it will not work automatically when the document is created in the library even though the ‘Start workflow automatically when an item is created’ is on?

    The only other thing that I can spot is that you may be using Lists. I am using a document library.

  7. Hi Ulrich,

    Good post but I’m stuck on a related issue that you might have an answer to: Once I created the folder, how would I also use a SharePoint Designer workflow to update the name of the folder? I’ve tried a number of approaches but the workflows keep crashing.

    Thanks, Eduard

    • Hi Eduard

      How is your workflows set up? Do you have two workflows or one big one?

      If you have one big WF, I would try and do the rename before the folder is created. Handle it by creating variables and the and the end, create the folder.

      If you have two workflows: eg. one creates the folder and then another one renames it, be aware that the workflows may be overlapping. Try and build a pause in the second workflow, as it might be starting before the folder is done being named. I don’t know that for sure and I would have to take a closer look at the concrete workflow to be more precise.

      I hope you can use it to finish your project. All the best, Ulrich

      • Hi Ulrich, thanks but I already figured it out. I was trying to identify the original folder with the wrong field. I had to use the “Name” field as the identifier.

        Cheers, Eduard

  8. Hi Ulrich,
    thanks for your hint how to create Folders and subfolders using a workflow.
    Like Simon Kirby, i am using document sets to organize our Project documents.
    I have a document library where i use Content types to create document sets. If a nes document set has been created, a workflow starts and created Folders and Subfolders within this specific document set.

    The workflow works fine, BUT the workflow creates all folders twice. On the one Hand the complete folder structure is created in the document set but on the other Hand it is created at the top Level of the document library too.

    If i delete the folders at the top Level of the document library using the same workflow, it will delete both Folder structures (the one at the top Level and the other within the documen set).

    If i delete it manually, everything is fine.

    Any suggestions??


  9. Hi Ulrich,
    First, thank you for posting this blog it was perfect for what I need to do, create a root folder with many subfolders. I had no problem with the process you outlined until I got to the 17th subfolder. I need to create 19 subfolder under the root and the workflow works wonderfully till it gets to the 17th and nothing happens, the last 3 subfolders are not created. The workflow keeps going successfully but no 17, 18,19 subfolders.

    I tried to put the last three in their own step but that did not work. Is there a limit to the number of folders that can be created? I confirmed that the method for the last 3 are the same as the other 16 but still no subfolders. Thanks in advance for you help.

    • Found the issue. Seems that one of the sub folder names had a “/” symbol in it and SP does not like those characters along with others like &, %, etc. Now I have all the subfolders I want.
      Thanks again for a good blog.

  10. Hello Ulrich,
    Excellect post, and thank you for your contribution.
    I have a request where in a document library user will:
    – Create Job Folders ( example: Job Folder Co 1, Job Folder Co 2 and so on)
    – Inside that comany job folders users will create Job number folders (example for Co 1 would be: 100000.1 Flint Hill Michigan F-9900)
    – Now the users want SubFolders to be createed automatically for each job numbers created for different companies. (SubFolder example: Daily Field Reports, Timesheets, Work Order, Archive etc.)

    I have followed all your steps, but i am not sure where i am doing wrong. Any help would be appreciated.

  11. Hi Ulrich,

    I’ve set up the workflow in a proper way – the SPD reports no errors in workflow when checked…

    When choosing a path for the library – I chose it from the drop down list… but when I create a new list item I receive an error that the library can’t be found or I have no access – I’m the admin with full access rights…

    any ideas?


  12. Hi,
    i want to create a custom folder structure like :
    -Folder A
    -Folder A/Folder AA
    -Folder A/Folder AA/Folder AAA
    how i can define Root folder for the subfolder
    for the first subfolder(folder AA) it’s works, but when i want to create Folder AAA i can’t define Root folder

    • Hi Sabri.
      The subfolder is actually named “AA/AAA”. You have to put in the rootfolder for each subfolder you wish to create.
      “AAAA” would then be “AA/AAA/AAAA”

  13. I want that a pop-up should be shown to user for emplty sub folders as there are compulsary documents required in the library. How to achieve this, please advice.


Leave a Reply

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