Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Does anyone know of a fast way to tell through code if a ContentType is one that's a pre-installed one?

Conversely, I want to know if a given ContentType was provisioned by a custom feature / generated by the user through the WebUI.

Sure, there are short ContentTypeIds (like 0x0102) and long ones (0x0100<flattened guid>), but is there any other way?

I'm asking for any version, 2007 or 2010.

share|improve this question
1  
I think this question dublicates sharepoint.stackexchange.com/questions/11090/… –  gandjustas Apr 14 '11 at 15:26

2 Answers 2

up vote 2 down vote accepted

http://www.pvle.be/2011/01/is-a-given-field-one-of-sharepoints-built-in-field/

share|improve this answer
    
That uses SPBuiltInFieldId, but there is a similar concept for built in ContentTypeIds, details here: msdn.microsoft.com/en-us/library/…. Cheers! –  James Love Apr 14 '11 at 15:56

Try this:

SPContentType ct;
//set your content type
bool builtIn = SPBuiltInContentTypeId.Contains(ct.Id);
share|improve this answer
    
Yup, pretty much inferred from the link posted by @gandjustas, but that's the approach I'll try. –  James Love Apr 14 '11 at 17:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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