Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/264.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 无法使用COM在包含自定义视图的自定义模板中创建基于列表的模板_C#_Sharepoint_Sharepoint 2013_Sharepoint Clientobject - Fatal编程技术网

C# 无法使用COM在包含自定义视图的自定义模板中创建基于列表的模板

C# 无法使用COM在包含自定义视图的自定义模板中创建基于列表的模板,c#,sharepoint,sharepoint-2013,sharepoint-clientobject,C#,Sharepoint,Sharepoint 2013,Sharepoint Clientobject,我无法基于Sharepoint 2013中的自定义列表模板创建列表。列表已正确创建,但不包含列表模板中定义的视图 在我的代码中,首先我得到listTemplate: ListTemplateCollection ltc = context.Site.GetCustomListTemplates(context.Web); context.Load(ltc); context.ExecuteQuery(); ListTemplate listTemplate = ltc.FirstOrDe

我无法基于Sharepoint 2013中的自定义列表模板创建列表。列表已正确创建,但不包含列表模板中定义的视图

在我的代码中,首先我得到listTemplate:

    ListTemplateCollection ltc = context.Site.GetCustomListTemplates(context.Web);
context.Load(ltc);
context.ExecuteQuery();
ListTemplate listTemplate = ltc.FirstOrDefault(n => n.Name == "name");
然后创建ListCreationInformation对象:

ListCreationInformation lc = new ListCreationInformation();
lc.Title = GetNameDocumentLibrary(nombreBibliotecaDocumentos);
lc.TemplateType = listTemplate.ListTemplateTypeKind;
lc.TemplateFeatureId = listTemplate.FeatureId;
lc.QuickLaunchOption = QuickLaunchOptions.DefaultValue;
然后,将列表添加到Sharepoint上下文中

List newList = context.Web.Lists.Add(lc);
newList.ContentTypesEnabled = true;
newList.OnQuickLaunch = true;
newList.Update();
context.ExecuteQuery();
最后,我分配ContentType:

List<ContentType> contentTypeCustom = new List<ContentType>();
foreach (ContentType ct in contentTypeColl)
if (ct.Group == "Tipos de contenido personalizados")
newList.ContentTypes.AddExistingContentType(ct);

newList.Update();
context.ExecuteQuery();
List contentTypeCustom=new List();
foreach(contentTypeColl中的contenttypect)
如果(ct.Group==“内容个性化提示”)
newList.ContentTypes.AddExistingContentType(ct);
Update();
context.ExecuteQuery();
但是,当我显示新列表的配置时,没有listTemplate中定义的视图

我不知道如何使用客户端对象模型从列表模板添加视图


感谢您的支持当前COM似乎无法从客户端定义的自定义列表模板创建列表。API似乎无法区分基本列表模板和从中继承的列表模板,因为它们共享相同的模板功能ID

我建议您直接从COM创建列表

参考:

当前COM似乎无法从客户端定义的自定义列表模板创建列表。API似乎无法区分基本列表模板和从中继承的列表模板,因为它们共享相同的模板功能ID

我建议您直接从COM创建列表

参考: