Delete Content Types in Asset Library Programmatically in Sharepoint 2010 |
A quick tip on how to delete the default content types in Asset library and adding your own custom content type using SharePoint 2010 object model. The default content types included with the AssetLibrary definition are Audio, video and Image. SPSite oSite = new SPSite(“http://blrs2r8-11″); SPWeb oWeb = oSite.OpenWeb(); SPListTemplate Otemplate = oWeb.ListTemplates["Asset Library"]; SPList oList = oWeb.Lists[oWeb.Lists.Add(" oList.ContentTypes["Video"]. oList.ContentTypes["Audio"]. oList.ContentTypes["Image"]. SPContentType oCtype = oWeb.ContentTypes["Custom Content Type"]; oList.ContentTypes.Add(oCtype) oList.Update(); |
Monday, November 28, 2011
Delete Content Types in Asset Library Programmatically in Sharepoint 2010
Category:
SharePoint 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment