How-To: Create folders in a SharePoint list using a SPD workflow
As you may know SharePoint lists are only supporting a limited number of items. For example, only 5000 items can be retrieved in a view. To get your list structured the usage of folders is recommended.
In the future I might provide a tutorial for activating the option to manually create folders in a list, though this is actually pretty simple. I will post a link here if I do so.
But you may ask "What if I don't want to create the folders manually?".Well, you could, of course, write your own application or event receiver creating all the folders for you. Still some of you might feel uncomfortable programming stuff for SharePoint or in general.
Well, there is yet another solution for our folder problem in SharePoint, at least in SP 2010.
All you need is the SharePoint Designer 2010 which can be downloaded from Microsoft directly. It enables you to create custom workflows which go far beyond what SharePoint provides out of the box.
After installing and setting up SPD, you can move on creating your automated folder creation workflow using my tutorial.
Now let's get it done
Prepare the list
For a custom workflow being able to create folders, you need to assign the folder content type to the list. To do so, you have two options: using the SharePoint Designer or your browser.
I will explain the more easier one (in my opinion), using the browser.
- Open the list in an internet browser. There will be an option bar at the top.
- Select "List" and choose "List Settings" in the new ribbon.
- Now, if you haven't done so already, click on "Advanced Settings", activate the option "Enable management of content types" and click on "OK".
- Head back to the list settings.
- Now there is a new section listing all content types for the list. Click on "Add from existing content types".
- In the new page, select "Folder Content Tpes" from the dropdown menu.
- Add the content type named "Folder" to the list content types by selecting it and clicking on the arrow pointing to the right.
- Click on "OK" to save the new assignment.
Please note: Still the folder won't appear in the content type section of the list settings, which I'm not sure of whether it is a bug or not. That also means that you cannot remove the folder content type from the list.
Create your workflow
As your workflow probably will have a different purpose than the one I made, I will only explain the important part. :-)
A folder is generally just a list item. So we are going to build on that.
- To create a folder, choose the action "Create a list item".
- Click on the blue part to open a window asking for some information.
- Choose the list where the folder shall be added from the dropdown field.
- If your list has multiple content types, a field to assign a value to, will automatically be added. It is called "Content Type ID". If it is not present, click on "Add" to add this field.
- For the value of this field you will have a dropdown selection from which you have to choose "Folder".
- To give the folder a name, also add the field "Title" and give it a value of you choice.
Please note that this value for "Title" has to be unique, so you might have to change your lookup or logic accordingly. That means that you should implement a check if a folder already exists, explained
here.
Final notes
Of course just having the folder might not be enough. So check out my tutorials on
how to place a list item inside a folder and
how to set permissions for a folder, both using SharePoint Designer Workflows.