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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Change Sharepoint libr...
Power Automate
Unanswered

Change Sharepoint library settings"Allow management of content types" using power automate

(0) ShareShare
ReportReport
Posted on by 36

Hi,

 

I am trying to change the "Allow management of content types" setting on an existing library to test the behaviour. We are currently building a new structure of sites and the sites themselves have been created but this setting needs to be enabled on all of them.

 

Is this possible or is this a setting that can only be provided during the creation of the document library?

 

Afterwards I would have to add a custom content type to the document library. How should I do this as I have been looking this up and it seems that the way you do this has changed recently.

 

What I have tried so far is this:

MatthiasVeelaer_0-1688461659848.png

but this gives an error as Patch is not supported on the list collection.

 

I have also tried it with post but then I get this error(which I guess has to do with the fact that it thinks I'm trying to create a library and therefore provide no library title):

MatthiasVeelaer_0-1688462245724.png

 

If anyone has an idea of what I could do that would be much appreciated! Thanks!

Categories:
  • Expiscornovus Profile Picture
    34,005 Most Valuable Professional on at

    Hi @MatthiasVeelaer,

     

    You can use a POST method for this. You do need to provide which list/library you want to update in the URI field though, otherwise it would not know which library you want to update.

     

    Below is an example

     

    URI

    _api/web/lists/getbyTitle('@{variables('ListName')}')

     

    Headers

    {
     "Accept": "application/json;odata=verbose",
     "Content-Type": "application/json;odata=verbose",
     "If-Match": "*",
     "X-HTTP-Method": "MERGE"
    }

     

    Body

    {
     "__metadata": {
     "type": "SP.List"
     },
     "ContentTypesEnabled": true
    }

     

    allowcontenttypes_restapi.png

     

  • MatthiasVeelaer Profile Picture
    36 on at

    Perfect! Thanks Expiscornovus this worked like a charm! 

    Now how would I go about actually adding the content type to the library through power automate as it seems the way to do this has been changed very recently?

     

    Thanks so much already though!

  • Expiscornovus Profile Picture
    34,005 Most Valuable Professional on at

    Hi @MatthiasVeelaer,

     

    If the content type already exists in the site (has been published from the content type gallery) you could use the AddAvailableContentType method.


    I have adjusted the earlier shared example and added that step as well.

     

    URI

    _api/web/lists/getbyTitle('@{variables('ListName')}')/contenttypes/AddAvailableContentType

     

    Headers

    {
     "Accept": "application/json;odata=verbose",
     "Content-Type": "application/json;odata=verbose"
    }

     

    Body

    {
    "contentTypeId" : "@{variables('ContentTypeId')}"
    }

     

    addavailablecontenttype_method.png

     

     

     

     

  • MatthiasVeelaer Profile Picture
    36 on at

    This still works? I find a lot of posts online saying this doesn't work anymore.

  • MatthiasVeelaer Profile Picture
    36 on at

    It keeps retrying 😕

    MatthiasVeelaer_0-1688473361018.png

    This is what my current flow looks like:

    MatthiasVeelaer_1-1688473414988.png

     

  • Expiscornovus Profile Picture
    34,005 Most Valuable Professional on at

    Hi @MatthiasVeelaer,

     

    What are you using in the ListID variable? The name of the variable suggests you are using a GUID or id.

     

    The getbytitle method however expects the title/name of the library or list. 

     

    In my case the name of my library was called 'Enable CTs'. In that case the Uri should be:

     

    _api/web/lists/getbyTitle('Enable CTs')

     

  • MatthiasVeelaer Profile Picture
    36 on at

    Yeah sorry, the name does indeed suggest that but I just forgot to rename the variable. It is a string 🙂

    MatthiasVeelaer_0-1688473780814.png

    There I changed it 🙂

  • Expiscornovus Profile Picture
    34,005 Most Valuable Professional on at

    Hi @MatthiasVeelaer,

     

    Can you also remove that AllowContentTypes from your first request. That property is not something you can set/update.

     

    You can only update the ContentTypesEnabled property. Also see my example. I am not using the AllowContentTypes property in my payload.

     

    And Yes, it should work. I just tested this flow in my own development environment and both the setting was enabled and the content type was added 😁

  • MatthiasVeelaer Profile Picture
    36 on at

    Alright! I will remove that. I will take another look at it and see whether or not I have made a mistake somewhere. Let's hope I missed something 😄

  • Expiscornovus Profile Picture
    34,005 Most Valuable Professional on at

    Hi @MatthiasVeelaer,

     

    I had another look at your last screenshot and specifically the URI of your second request. I noticed a potential space character in the middle.

     

    Can you also make sure there is no accidental typo/space character in the uri. Specifically between the /contenttypes and the listtitle variable?

     

    Below is an example typo gif (click on it to see it in higher resolution).

     

    typoinuri.gif

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 289

#2
11manish Profile Picture

11manish 288 Super User 2026 Season 2

#3
Henil Profile Picture

Henil 125

Last 30 days Overall leaderboard