小编Ana*_*han的帖子

如何从列表模板创建新列表(客户端对象模型)

我正在基于自定义列表模板创建列表.列表正在创建,但自定义列表模板不适用于我的列表.

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();
Run Code Online (Sandbox Code Playgroud)

如何修改我的代码以应用自定义列表?

sharepoint sharepoint-2010

5
推荐指数
1
解决办法
7224
查看次数

标签 统计

sharepoint ×1

sharepoint-2010 ×1