Question

I have a document library using a document set content type. I can create a new document set through the UI and it works perfectly.

I'm now trying to create a document set in this library programmatically and it's not working properly. Here is the code (based on MSDN documentation):

// Set some properties
Hashtable properties = new Hashtable();
properties.Add("UploadComplete", false);
properties.Add("FilenameCode", code);

// Create the set
DocumentSet invoiceSet = DocumentSet.Create(
  list.RootFolder, code, InvoiceSetContentTypeId, properties, true);

What's not working:

  • icon for the set looks like a folder instead of the document set icon

  • clicking on the document set doesn't show the document set home page, it just behaves like a normal document library

  • running CAML queries shows that both internal fields HTML File Type and ProgId should be SharePoint.DocumentSet but instead they are blank

  • changing a field value on the document set folder doesn't propogate to its contents (although perhaps this is supposed to work differently)

Anyone know what I'm doing wrong?

Was it helpful?

Solution 3

I deleted the Document content type from the library which resulted in Document Sets only working through the UI.

OTHER TIPS

J had the some issue. To solve the problem You must use content type id from the list, which is child of Your custom content type id.

DocumentSet invoiceSet = DocumentSet.Create(list.RootFolder, code, list.ContentTypes.BestMatch(InvoiceSetContentTypeId), properties, true);

I had this issue with some folders I had converted to document sets, and I don't know whether this solution will work for you. But I submitted them to the content organiser and let the content organiser put them back into the original location, all the document set properties were correct, I got the icon back, and the welcome page etc.

Like I said, not sure if this will help you, but it may be an option.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top