Question

I have a SPO site with some DocumentSets having different ContentType. I need to get "Allowed Content Types" of any DocumentSet to take a decision: I get my DocumentSet as ListItem or as Folder or as DocumentSet (Microsoft.SharePoint.Client.DocumentSet) but, in any form it is, I can't find a way to reach the allowed Content Types, any advice?

Thanks in advance.

Était-ce utile?

La solution

You should be able to get it through the UniqueContentTypeOrder property. Here's the part of the code that I used in one of the proejcts to get those values:

var docset = web.GetFolderByServerRelativeUrl("DOCUMENTSETURL");
context.Load(docset);
context.Load(docset, l=> l.UniqueContentTypeOrder); 
context.ExecuteQuery();

foreach(var ctid in docset.UniqueContentTypeOrder)
{
    Console.WriteLine(ctid);
}    
Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top