1

I use CAML queries to find items by "ContentTypeId".

How can I create an index for this column? In the user interface I can only select "Content Type", not the ID.

1 Answer 1

1

You can use SPField.Indexable Property to check whether ContentTypeId field can be indexed or not. Per this http://iedaddy.com/2010/11/sharepoint-2010indexing-columns-in-a-sharepoint-list/ Content type ID cannot be indexed. However, one of the comments mentions that

Creating an index on “ContentType” really creates an index on “ContentTypeId”, that makes searching for a contenttype in a sitecollection much faster.

1
  • I checked the "SPField.Indexable" property by code. ContentTypeId => true, ContentType => false. I think its because "ContentType" is a "computed" field that relies on "ContentTypeId".
    – pindumb
    Jun 26, 2016 at 8:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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