我正在基于自定义列表模板创建列表。列表正在创建,但自定义列表模板不适用于我的列表。如何从列表模板(客户端对象模型)创建新列表
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();
如何修改我的代码以获取应用的自定义列表?
首先的特征的特征标识符的值,你”不要无效检查模板对象,所以你可能实际上没有得到你以后的模板。其次,这看起来不像我的列表模板名称。 – GavinB 2012-03-04 02:59:08