【发布时间】:2010-09-19 01:36:13
【问题描述】:
我有一个父网站,我想在其下使用 Visual Studio 2010 动态创建子网站。
我要创建的子网站有一个共同的结构(在列表和自定义方面)。
所以我将模板保存在sharepoint 2010中,它变成了wsp并进入了解决方案库。
现在我如何使用这个模板,比如 mytemplate.wsp,在 Visual Studio 中创建站点。
我试过了
使用(SPSite 站点 = 新 SPSite ("http://infml01132:5566/sites/VRND" ))
{
using (SPWeb web = site.OpenWeb())
{
SPWebTemplateCollection myTemplates = site.GetCustomWebTemplates(Convert .ToUInt32(web.Locale.LCID));
//SPWebTemplateCollection temlates1 = site.GetCustomWebTemplates(1033);
//SPWebTemplateCollection temlates = site.GetWebTemplates(1033);
//SPCustomWebTemplate
SPWebTemplate subsitetemplate = myTemplates["vrndtmpl" ];
web.Webs.Add("subsite1" , "rnd subsite1" , "subsite description changed" , Convert .ToUInt16(1033), subsitetemplate, false , false );
}
}
但我没有在 mytemplates 集合中找到我的模板。
谢谢
【问题讨论】:
标签: visual-studio-2010 sharepoint-2010