Power Community

Power Community

Allow management of Content Types on SharePoint Lists using Power Automate

Within SharePoint there is the option to allow management of content types. But how do you manage this setting within Power Automate?

Allow management of content types
Allow management of content types

Management of Content Types

First, of all, why would we need to enable content types on a library. For both cases the New menu in the library will show your content types.

When you have a library where the management of content types is disabled and you use the get file properties action to retrieve the content type of the library, then the content type details for your files and folder are not being returned.

Content Types not returned
Content Types not returned

Where if we enable the setting the Get File Properties action output will look like this:

...
"{FullPath}": "Shared Documents/Folder1",
  "{ContentType}": {
    "@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedContentType",
    "Id": "0x012000A235779F9928584AB5D2CA8E3028D13D",
    "Name": "Folder"
  },
  "{ContentType}#Id": "0x012000A235779F9928584AB5D2CA8E3028D13D",
...

If we need a flow to know the content type used by a file or folder then we will need to enable the setting on the library.

Enable Management of Content Types

To Enable the Management of content types we can build a small flow as follows:

Allow management of content types on a SharePoint library
Allow management of content types on a SharePoint library

The end point used is:

_api/web/Lists/getByTitle('Documents')

The Headers of the action are set like this:

{
  "Content-type": "application/json; odata=verbose",
  "Accept": "application/json; odata=nometadata",
  "IF-MATCH": "*",
  "X-HTTP-Method": "MERGE"
}

The body is set like this:

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

And that is it! A quick simple solution for an annoying problem.


Discover more from SharePains

Subscribe to get the latest posts sent to your email.

This post was originally published on this site

- Advertisement -spot_img

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisement - Advertisement

Latest News

More Articles Like This

- Advertisement -spot_img