2
有可能使用列表模板来创建新的文档库,我想下面的代码,但它不工作,只是不使用模板创建库。sharepoint 2013使用列表模板创建文档库C#
ListTemplateCollection listTemplates1 = context.Site.GetCustomListTemplates(context.Web);
ListTemplate li1;//
context.Load(listTemplates1);
context.ExecuteQuery();
context.Load(site.ListTemplates);
context.ExecuteQuery();
var listTemplate = listTemplates1.First(lt => lt.Name == "<Test>");
ListCreationInformation li = new ListCreationInformation();
li.Title = "XYZZ2";
li.Description = "Created through Code";
li.TemplateFeatureId = listTemplate.FeatureId;
li.TemplateType = listTemplate.ListTemplateTypeKind;
List newList = context.Web.Lists.Add(li);
context.Load(newList);
context.ExecuteQuery();
谢谢你的回复。我试图获取模板的代码,但我得到了默认模板,我已经创建了自定义模板(其中包含文件库结构的文件库),我想使用它。如何获取自定义模板。 –