我得到了一個代碼,使用Visual Studio 2010創建自定義SharePoint列表。但是,我可以在Visual Studio 2010中放置此代碼的位置在任何地方都沒有提及。有人可以幫我嗎?我真的很掙扎。這裏是代碼:在SharePoint列表中需要幫助。
using (SPSite oSPsite = new SPSite("http://Web URL"))
{
oSPsite.AllowUnsafeUpdates = true;
using (SPWeb oSPWeb = oSPsite.OpenWeb())
{
oSPWeb.AllowUnsafeUpdates = true;
/* 1. create list from custom ListTemplate present within ListTemplateGalery */
SPListTemplateCollection lstTemp = oSPsite.GetCustomListTemplates(oSPWeb);
SPListTemplate template = lstTemp["custom template name"];
oSPWeb.Lists.Add("List Name", "Description", template);
/* 2. create list from sharepoint list content type (e.g. Links) */
oSPWeb.Lists.Add("List Name", "Description", SPListTemplateType.Links);
oSPWeb.AllowUnsafeUpdates = false;
}
oSPsite.AllowUnsafeUpdates = false;
}
+1的功能接收