cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
landonjochim
Resolver I
Resolver I

Adding a Content Type to a document library using Send HTTP Request

Hello Community, 

 

I am wondering if it is possible to add an existing content type to a document library using the SharePoint Send HTTP Request? I have a flow that gets a list of new sites, and I would like to automatically cycle through those and add a content type to their default document library.  

 

If this is not possible, is it possible to add an existing managed metadata column to a document library using the Send HTTP Request?

 

Thanks for the help. Always appreciated. 

9 REPLIES 9
Expiscornovus
Super User
Super User

Hi @landonjochim,

 

If the content type already exists on the site and on the library the management of content types is allowed you could use the addavailablecontenttype method to add it.

 

Below is an example of that:

addavailablecontenttype.png

Thanks for the response that helped! Is there a method to set the default content type?

Expiscornovus
Super User
Super User

Hi @landonjochim,

 

It might be possible via the uniqueContentTypeOrder method:

https://sharepoint.stackexchange.com/questions/273329/managing-content-type-using-rest-api

 

But I haven't tried that myself to be honest.

Hello, I have the same question about setting the default content type. Did you manage to get it to work?

NavinKanus
New Member

Has anyone recently been able to add content types using addavailablecontenttypes rest api ?

 

Looks like this will no longer works since microsoft has updated the way content types are now published and pulled(On-Demand) instead of pushed to all site collections.

 

Is there a new rest api that can be used now to add a content type from content type hub to a list or library ?

Expiscornovus
Super User
Super User

Hi @NavinKanus,

 

Just retested my previous setup. Does not look like it is working anymore.

 

However, it does look like there is a new method which you can use in a $batch with the v2.1 API, addCopyFromContentTypeHub

 

batchrequest_v21api.png

Thank you very much for pointing that out. Yes, I saw the same in the network trace but I was not able to look at the Request part of the trace. May be I will have to use a different tool other than developer tools in Edge.

 

Let me test it out, hopefully this will resolve my concern.

Expiscornovus
Super User
Super User

Hi @NavinKanus,


I am using the Network monitor in the FireFox Developer Tools for this:

https://firefox-source-docs.mozilla.org/devtools-user/

Thanks @Expiscornovus 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,242)