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?


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);

| improve this answer | |

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.

| improve this answer | |

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

| improve this answer | |
  • I followed your instructions, but this did not solve the problem. Any other suggestions? – user1546 Sep 30 '10 at 14:37
  • Do you have the exact same symptoms? If not, you should ask a new question describing the exact issue you're having. If you are then sorry I'm not sure what else would help. – Alex Angas Sep 30 '10 at 22:52
  • hi alex i tried your method it did not work. i then tried the the above method and it worked perfectly. i had the exact same issue as you had – Sebastien Stettler Mar 1 '12 at 15:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.