3

Currently i am creating an Export and Import Tool for SharePoint 2010 to 2013.

The Export Tool exports a whole list or DocumentLibrary to a File. In my DocumentLibrary i have serveral Document Sets.

In my Code i use this to make a distinction between a Folder and a Document Set:

if (ListItems.ProgId == "SharePoint.DocumentSet")

This works for now but it feels like this solution is unclean....

Is There a better way to do this?

6

You can check if your item content type inherits from DocumentSet base content type that is 0x0120D520.

Using C#:

listItem.ContentTypeId.IsChildOf(new SPContentTypeId("0x0120D520"))

or

listItem.ContentTypeId.ToString().StartsWith("0x0120D520")
| improve this answer | |
2

The base Document Set content type ID is 0x0120D520, so maybe you could do something like

SPContentTypeId documentSetID = new SPContentTypeId("0x0120D520");
if (listItem.ContentTypeId.IsChildOf(documentSetID))
{
    // do something
}

Here is the MSDN documentation on the SPContentTypeId class, take a look at the methods IsChildOf and IsParentOf.

| improve this answer | |
  • I gave the "Correct Answer Tag" to ECM4D because he was faster. But Thanks for Answer anyway :) – Cryol Sep 18 '15 at 15:48

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.