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.

有帮助吗?

解决方案

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);
}    
许可以下: CC-BY-SA归因
scroll top