web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Set a new default cont...
Power Automate
Answered

Set a new default content type

(0) ShareShare
ReportReport
Posted on by 47

Thanks to this forum I have now cracked, making a SharePoint document library and assigning a new custom content type from a site available list.

 

I have just found out that I need to make the new content type default.

 

I found this - https://sharepoint.stackexchange.com/questions/273329/managing-content-type-using-rest-api though it does not really discuss making a content type default.  

Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,194 Most Valuable Professional on at

    Hi @rhood,

     

    That thread is talking about the ordering. I have tried to POST request, but it wasn't working for me. It didn't change the ordering like suggested in that solution.

     

    Are there any other Content types in use in your library? Otherwise you could remove those from the library and the only one left is automatically the default one. That could be a workaround.

     

    If so, you could use the following URI for a POST request in a Send a HTTP request to SharePoint action for that.

     

    _api/web/lists/getbytitle('@{variables('ListTitle')}')/ContentTypes('@{variables('ContentTypeId')}')/deleteObject() 

     

     

    Alternatively, you could also use this PnP PowerShell cmdlet:

    https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/set-pnpdefaultcontenttypetolist?view=sharepoint-ps

     

  • rhood Profile Picture
    47 on at

    Thanks, I had been trying that.

     

    This morning I used the call below to collect the contenttypes from one of my folders.

     

    _api/web/lists/getbytitle('@{variables('ListTitle')}')/ContentTypes

     

    I expected to see two, Document and Email.  I wanted to delete Document but the ID deleted Email instead.

     

    Looking at the two IDs in the output from the above call they seem to be the same???

     

    Document - ContentType ID=\"0x0101004DAFA0A932C94645B584822535763071004C69C8D6BB964C40BDBC40D8F258493F

    Email

    - ContentType ID=\"0x0101004DAFA0A932C94645B584822535763071004C69C8D6BB964C40BDBC40D8F258493F

     

    I would have expected each ID to be unique. Am I missing something?  I tried just 0x0101 that shows as the Document ID in SharePoint but this fails.

  • Expiscornovus Profile Picture
    33,194 Most Valuable Professional on at

    Hi @rhood,

     

    I would also expected two different ids.

     

    Do you want to run this in a GET request instead?

    _api/web/lists/getbytitle('@{variables('ListTitle')}')/RootFolder/uniqueContentTypeOrder

     

    This should give back a results property with the existing order.

     

  • rhood Profile Picture
    47 on at

    Thanks,

    Diving in a little more, it seems that each content type has it own unique value for each document library. 

    I can delete the content type if I manually enter the correct ID so that's a good start!

    To do this without manual intervention I am using get contenttype command to return all content type data: 

     

    _api/web/lists/getbytitle('TEST 50')/ContentTypes

     

    then running the output through several filters in order to retrieve the unique ID for document type (I may me going too far but is all I can think off).

     

    rhood_3-1638974541866.png

    I then pass this output to a variable

    rhood_2-1638974294909.png

    The value is [{"TypeID":"0x010100265C8847F1165C4980E7136341167606"}]

    How do I only get 0x010100265C8847F1165C4980E7136341167606 as I with to use this variable in the final HTTP request to delete the content type?

     

  • Verified answer
    rhood Profile Picture
    47 on at

    GOT IT. Thank you for you input

     

    rhood_0-1638977806939.png

    This find the unique ID for any given doc library, filters out Documents and deletes it.

  • Krati22 Profile Picture
    2 on at

    Hey,

    I have the similar requirement to set a default content type using flow. Can you please provide the solution with screenshot?

  • rhood Profile Picture
    47 on at

    Hi,

    No problem.  My solution does rely on having a single content type at the end.

    Here is my full flow:

    rhood_0-1642067738833.png

     

    The document folder needed to have the Content type set to managed during creation:

    rhood_1-1642067866901.png

    I then added my new content type -Email:

    rhood_2-1642068006292.png

    To find the content type ID I went to Site Settings > Site content types and choose the relevant content type

    rhood_3-1642068208967.png

    Now from here was a lot of trial and error as I could not find a way to just set Email as the default content type so as mentioned above I rely on deleting the only other document type - Document. This then forces Email to become the default.

     

    What I seemed to find was that using the same method as above to find the content ID did not work.  From what I could see, the ID was unique to each document library so I needed to extract this information:

     

    rhood_5-1642068587751.png

    I then ran the results through Parse JSON to get access to the variables:

    rhood_6-1642068635420.png

    As there are more than one content type I further filtered the result (someone with more knowledge here could likely do this more efficiently):

    rhood_7-1642068860134.png

    Then finally I used this ID to delete the document content ID leaving me with Email as the default. Stringid held the value.

     

    rhood_8-1642068932333.png

     

    I hope this helps!

  • JOJO03 Profile Picture
    2 on at

    Hello,


    I would like to create a SharePoint view that shows me all the documents with the same content typeId in my site collection. 

     

    Thank you for your help in advance.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard