SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Has anyone been able to re-order content types for a list in code?

If I'm given a specific content type, I want to make it the default in a list, by re-ordering the SPList.ContentTypes collection and setting my content type to position 0.

I've tried making a new collection (SPContentTypeCollection), setting the order in a loop and replacing the SPList.ContentTypes, but unfortunately that property is read-only.

The SPBaseCollection (which is inherited by SPContentTypeCollection) is pretty darned limited when it comes to collection operations.

share|improve this question
up vote 1 down vote accepted

It's been a while since I had to do this. But from memory, rather than playing with the SPContentTypeCollection on the SPList, you should modify the SPFolder.UniqueContentTypeOrder property on the SPList.RootFolder.

Doing this will let you re-order the ContentTypes, and from memory you are correct about the item at index 0 being the Default.

share|improve this answer
Awesome, cheers! The UniqueContentTypeOrder is an IList which is nicer to play with. Why do all things with content types have so many aliases? :( – James Love Jan 14 '11 at 12:51

Your Answer


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.