【发布时间】:2017-04-05 03:10:59
【问题描述】:
我正在根据自定义列表模板创建列表。正在创建列表,但自定义列表模板不适用于我的列表。
ListTemplate template = null;
ListTemplateCollection ltc = context.Site.GetCustomListTemplates(context.Web);
context.Load(ltc);
context.ExecuteQuery();
foreach (ListTemplate t in ltc)
{
if (t.InternalName == "STPDiv.stp")
{
template = t;
break;
}
}
ListCreationInformation info = new ListCreationInformation();
info.Title = "TestCreation";
info.TemplateType = template.ListTemplateTypeKind;
info.TemplateFeatureId = template.FeatureId;
info.QuickLaunchOption = QuickLaunchOptions.DefaultValue;
site.Lists.Add(info);
context.ExecuteQuery();
如何修改我的代码以应用自定义列表?
【问题讨论】:
-
首先你不是空检查模板对象,所以你很可能实际上没有得到你想要的模板。其次,这在我看来不像是列表模板名称。
标签: sharepoint sharepoint-2010