Forum Discussion

Christophe Humbert's avatar
Christophe Humbert
Iron Contributor
May 20, 2018

Add two content types via REST

Hello,

 

I am trying to add two content types to a library via REST.

 

I am sending two REST requests. For each content type, my code looks like this:

fetch(SiteURL + "/_api/web/lists/getbytitle('" + libName + "')/ContentTypes/AddAvailableContentType", {
method: "POST",
body: JSON.stringify({
"contentTypeId": "xxxxxx"
})

})

When I run the code, only one of the two content types gets added. Separately, both work. What am I missing?

Side question: does PnP js core have a method for adding content types?

 

No RepliesBe the first to reply

Resources