3

How can I get default content type of sharepoint list programmatically?

4

SPContentType defaultCT = list.ContentTypes[0];

This should get you the first content type which is the default one.

1

You can run the following to determine the content type ordering (first is default).

SPList list = (code to identify your list instance here);
var listFolder = list.RootFolder;
var contentTypeOrder listFolder.UniqueContentTypeOrder;
var defaultContentType = contentTypeOrder[0];

The defaultContentType variable will then contain the default content type object.

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.