
Announcements
Hi expects,
We initially create a new library in share point and added content type to the library. Now we need to make the newly added content type "TempContentType" as default content type, as there is already a another content type of "Document" is created initially on library creation.
Here we got making default content type by deleting others - https://powerusers.microsoft.com/t5/General-Power-Automate/Set-a-new-default-content-type/m-p/1375031/highlight/true#M82278
So we need to make the newly created "TempContentType" as default content type without deleting other content types.
Thanks in advance.
Hi @Naveenav,
I had another look at this and found that it should be possible via a POST request on the RootFolder of the list. So, no need to remove any existing content types, yay! 😁
On that RootFolder you can set the UniqueContentTypeOrder property value. Kudos to Sorin Sandu with this blog to steer me into the right direction, https://tinysharepoint.wordpress.com/2021/02/01/change-content-type-order-using-uniquecontenttypeorder/
Below is an example
URI
_api/web/lists/getbytitle('@{variables('ListName')}')/RootFolder
Headers
{
"Accept": "application/json;odata=verbose",
"Content-Type": "application/json;odata=verbose",
"If-Match": "*",
"X-HTTP-Method": "MERGE"
}
Body
{
"__metadata": { "type": "SP.Folder" },
"UniqueContentTypeOrder": {
"__metadata": { "type": "Collection(SP.ContentTypeId)" },
"results": [
{ "StringValue": "0x0120D52000D7B65730C11A7B4CB3E96056EEC49DCE0079469C975343344EA7EF1D3391006E14"},
{ "StringValue": "0x0100753374BDCA807E4888D2017054283F7A00F8313B858F09DB479E4C3142BAC545D0"}
]
}
}