I been trying to add new custom folder content type to the document library programatically in my sandbox environment and it does show up on the document library. But, when I move same code to the almost similar configured SP2010 environment, adding
new folder content type to the document library doesn't show up on the document library's new menu.
Here is the code? Since this code works fine in my sandbox environment, is there any other settings I should check on the server environment which would cause hiding content type on new menu of document library.
static void Main(string args)
SPSite spSite = new SPSite("http://sp2010vm");
foreach (SPWeb spWeb in spSite.AllWebs)
spWeb.AllowUnsafeUpdates = true;
//For each site, cycle through lists
bool isDocLibraryExists = false;
foreach(SPList spList in spWeb.Lists)
if(spList.Title == "Classified Documents")
isDocLibraryExists = true;
if(isDocLibraryExists == true)
//Create new doc library
SPList splist = spWeb.Lists["Classified Documents"];
//Create Content Type
SPContentType documentContentType = spWeb.AvailableContentTypes["Classified Documents Folder"
View Complete Post