Sharepoint 2010 SharePoint 2010,沙盒解决方案,使用GetCustomListTemplates中未提供的功能将.STP文件上载到_catalogs/lt
我有一个沙盒解决方案,它有两个功能(都是站点集合级别的功能) 我正在使用同一用户激活这两个功能 功能1:通过模块文件将.stp文件上载到\u catalogs/lt文件夹 功能2(依赖于功能1):它将通过.GetCustomListTemplates(spweb)方法从_catalogs/lt获取所有.stp文件,但没有文件进入 这是我的密码Sharepoint 2010 SharePoint 2010,沙盒解决方案,使用GetCustomListTemplates中未提供的功能将.STP文件上载到_catalogs/lt,sharepoint-2010,Sharepoint 2010,我有一个沙盒解决方案,它有两个功能(都是站点集合级别的功能) 我正在使用同一用户激活这两个功能 功能1:通过模块文件将.stp文件上载到\u catalogs/lt文件夹 功能2(依赖于功能1):它将通过.GetCustomListTemplates(spweb)方法从_catalogs/lt获取所有.stp文件,但没有文件进入 这是我的密码 using (SPSite mySite = properties.Feature.Parent as SPSite) {
using (SPSite mySite = properties.Feature.Parent as SPSite)
{
using (SPWeb spWeb = mySite.OpenWeb())
{
spWeb.AllowUnsafeUpdates = true;
SPListTemplateCollection listTemplates = mySite.GetCustomListTemplates(spWeb);
}
}
listTemplates没有.stp文件。它是空的
请帮助我…您的列表模板是否源自“讨论板”之类的默认列表模板?我注意到,当我尝试执行以下操作时,我遇到了与您相同的问题:
如您所见,“BulletinBoard”图像与“Discussion Board”图像相同,因此SharePoint可能无法使用“BulletinBoard”模板,因为“Discussion Board”模板尚未安装。如果您在SharePoint 2010中将记录中心用作根网站的模板,则GetCustomListTemplates()将始终返回0(零) 有一个奇怪的错误,使这种情况发生 以下是您可以尝试在SharePoint PowerShell中运行的代码。如果您使用记录中心模板创建根站点,则GetCustomListTemplates($web)。Count的返回值将为零
$site = get-spsite("http://localhost")
$web = $site.RootWeb
$list = $web.Lists["TestDocLibrary"]
$list.SaveAsTemplate("MyListTemplate.stp", "MyListTemplate", "My List Template", $false)
$site.GetCustomListTemplates($web).Count
有关更多信息,请访问以下网页: