:focal())
Working with SharePoint? Then you probably like to bundle files, projects or customer documents in a document set. Power Automate creates them for you, in three different ways, each with its own pros and cons.
Pieter Bollen, Modern Workplace Consultant at Xylos, compares the three and explains which one he prefers himself. This is a technical blog, written for people who build their own flows in Power Automate.
What you need to know first
In this blog I discuss three ways to create a document set in a SharePoint library:
create a folder and change its properties to turn it into a document set
use an HTTP call to create the document set for a specific library
use an HTTP call to create a document set regardless of the library
To get the most out of this blog, you should already be familiar with:
libraries and document sets in SharePoint
Power Automate and HTTP actions
I won't repeat what a document set is and how to activate one. You'll find plenty of information about that online. First, I'll explain how the unique GUID of a content type works. You need it for all three solutions.
The basics: the GUID of a content type
The default document set at site level
The default document set content type in SharePoint has a short GUID at site level: 0x0120D520.
You find this GUID in the site settings. Click Site content types and then the Document Set content type to open its details.

The document set inside a library
When you link the document set to a library, it gets its own GUID. That GUID is much longer than the original one and differs for each library. You find it in the library settings: click the document set and look at the URL.

As an example, I created two libraries and linked the document set content type to both. These are the GUIDs:
LibraryOne:
0x0120D5200022762950706F4D4CBE6FCA8840AB408FLibraryTwo:
0x0120D520002ECE666D6D6B9144A09E65BDC5AD7A5C
Both GUIDs start with the same prefix: the GUID of the content type at site level. Keep this in mind, because it comes back in solutions 2 and 3.
Your own document set at site level
When you create your own document set content type at site level, its GUID is longer than the one of the built-in SharePoint type. When you link that type to a library, another set of characters is added:
1] 0x0120D520
2] 0x0120D52000C6633753113A1542AD9D3A5EC888C0A7
3] 0x0120D52000C6633753113A1542AD9D3A5EC888C0A700242B3CCAB297504DBB08C302004CC688Line 1 is the default SharePoint GUID for a document set at site level.
Line 2 is the GUID of your own document set at site level.
Line 3 is the GUID of that custom document set, linked to the library.
Solution 1: turning a folder into a document set
I'll be honest: this solution is not my preference and I don't use it myself. I still explain it, because it's widely used. That way I can at least try to convince you to stop using it.
Compare it to turning a bicycle into a motorcycle. The result may be what you want, but why not buy a motorcycle in the first place?
The first action in your flow creates a folder. Many people see this as a good starting point, since a document set in a way inherits the settings of a folder.

The result is a folder. It's not a document set yet.

Next, you change the properties of that folder to turn it into a document set. For this you need the ID of the new folder. You get it directly from the action that created the folder.
Tip: if you test step by step, delete or rename the folder after each run. You can't create a second folder with the same name.

The result:

Note two things. Filling in a title doesn't change the name of the document set (green marker). You also need the GUID of the document set in this library (yellow marker). In this example it's hard coded. It would be better to retrieve the GUID with an extra call, but I won't cover that here.
That's it in a nutshell: the most basic way to create a document set.
Solution 2: an HTTP call that creates the document set
In the second solution, an HTTP action creates the document set directly.

What you need:
Site address (removed in the screenshot)
Method: POST
Uri:
_vti_bin/listdata.svc/<yourlibraryname>Paste the site address and the uri together in your browser's address bar to see the result. A library has three names: a SharePoint name, a display name and a _vti_bin name. The last one never contains spaces, even if your library name does.
Slug: build it as follows:
https://env.sharepoint.com/sites/<siteName>/<LibraryName>/<DocumentSetName>|0x0120D520004D04A0BF2EC87B44BB23F203E18733D4The document set name in the slug is the final name of your new set, like BlogExample in the first example. So it's the name of your set, not the name of the content type.
The GUID is the one of the content type in the library. You can read above how to find it.
Next, you fill in the metadata linked to your document set with a second HTTP action.
What you need:
Site address (removed in the example)
Method: POST
Uri:
/_api/web/lists/getByTitle('<yourLibraryName>')/items(ID)Instead of getByTitle, you can also use the GUID of the list:
_api/web/lists(guid'YOUR-LIST-GUID'). Use whichever suits you best.items(ID)is the ID of the document set you just created. If the previous action doesn't return it directly, retrieve it with a Parse JSON action.
Headers:
{
"Content-Type": "application/json;odata=verbose",
"Accept": "application/json;odata=verbose",
"X-HTTP-METHOD": "MERGE",
"If-Match": "*"
}Body:
{
"__metadata": { "type": "SP.Data.<LibraryName>Item" },
"ProjectDescription": "your description",
"InternalProjectName": "your text"
}Note: the library name in type (in the body) can differ from the name in the uri. Always add the fixed text Item after it.

Solution 3: creating a document set with a single HTTP call
With the third solution, you create the document set in one go, without the library-specific GUID. You use the GUID of the content type at site level: the short one from the start of this blog.
I found this very useful on a site with several similar libraries. When a new item is created, a child flow creates a document set in the right library. That child flow uses the site-level GUID. This way you avoid a complex case structure per library, and you never have to pass on or request the library-specific GUID.
An extra bonus: you fill in the document set metadata in the same action.
What you need:
Site address (removed in the example)
Method: POST
Uri:
/_api/web/lists/getByTitle('<yourLibraryName>')/AddValidateUpdateItemUsingPath
Headers:
{
"Accept": "application/json;odata=verbose",
"Content-Type": "application/json;odata=nometadata"
}Body:
{
"listItemCreateInfo": {
"FolderPath": {
"DecodedUrl": "/sites/ABC0123/<yourLibraryName>"
},
"UnderlyingObjectType": 1
},
"formValues": [
{
"FieldName": "ContentTypeId",
"FieldValue": "0x0120D520"
},
{
"FieldName": "FileLeafRef",
"FieldValue": "<yourDocumentSetName>"
},
{
"FieldName": "yourExtraFieldName",
"FieldValue": "<value>"
}
],
"bNewDocumentUpdate": true,
"datesInUTC": true
}
All solutions side by side
I never liked using solution 1, because you create something only to turn it into something else. That's why I used solution 2 for a long time, until I got to know solution 3. It saved me from some technical issues, keeps my flows readable and needs fewer accountable actions.
The choice is yours. These are the strengths and weaknesses side by side:
Solution 1: turning a folder into a document set
Simple and not very technical. That's why it's widely used.
Still, try to avoid actions that create something only to change it into something else.
A document set inherits from a folder, but you can't see what happens under the hood. So you can't be sure that changing a property is enough to turn it into a complete document set.
Solution 2: an HTTP call per library
You work with an HTTP action, which can be tricky if you're new to Power Automate.
Creating the set and filling in the metadata happen in two separate steps.
You need the library-specific GUID.
This is a correct way to create a document set as intended.
Solution 3: a single HTTP call
A single HTTP call solves a lot of issues.
You create the document set and fill in the metadata at the same time.
You use the general GUID at site level, so you don't need to ask the library for its specific GUID.
Ideal for a parent-child setup with multiple libraries on the same site.