In SharePoint 2007 and WSS v3 it is possible to add multiple content types to a single list or document library. After adding the content types to your list, you can use the option “Change new button order and default content type” to change the order of the content types. If you uncheck the Visible checkbox, this content type will not appear in the New menu. The first content type in the list is considered the default content type. When a user clicks the New button instead of opening the New menu, the default content type will be selected for the new list item or document.
Besides setting these options in the user interface, you can also set them from code. In my example, I have a document library with 3 custom content types added in the wrong order as you can see below. This example will work on any SharePoint list.

In the code example we will re-order the content types and change the visibility. We only want content types 1 and 2 to appear on the new menu. While investigating how to do this, I found that these properties are stored at a folder (SPFolder) level. This means that you can sort your content types in a different way for each folder. And you can also let each folder have a specific set of content types. To see this in the user interface, create a folder, open the drop down menu and select “”.

The code snippet below sets the options for the list itself. This uses the RootFolder property of the list to find the correct folder. The sample assumes that you have a list or document library with some extra content types assigned.
SPSite site = new SPSite("http://office2007:300");
SPWeb web = site.AllWebs["intro/beheer"];
SPList list = web.Lists["Docs"];
list.ContentTypesEnabled = true;
SPContentType listCt1 = list.ContentTypes["ContentType1"];
SPContentType listCt2 = list.ContentTypes["ContentType2"];
SPContentType listCt3 = list.ContentTypes["ContentType3"];
SPFolder folder = list.RootFolder;
SPContentType[] orderedContentTypes = new SPContentType[2];
orderedContentTypes[0] = listCt1;
orderedContentTypes[1] = listCt2;
folder.UniqueContentTypeOrder = orderedContentTypes;
folder.Update();
Each SPFolder object has a property called UniqueContentTypeOrder. This is an IList of SPContentType objects. Content types that are not in this list, are not visible. After running the code, the content types at the document library level now look like this:
