Here’s the sample to add and set a new content type as a default content type to a document library in a SharePoint site. Also this will hide the pervious default content type. SPSite oSPSite = new SPSite ( "" ); // Site URL SPWeb oSPWeb = oSPSite.OpenWeb();