2016-03-30 3 views
1

Sharepoint 2013のカスタムリストテンプレートに基づいてリストを作成できません。リストは正しく作成されますが、リストテンプレートで定義されたビューは含まれません。私のコードでCOMを使用してカスタムビューを含むカスタムテンプレートに基づくリストを作成できない

、最初に私は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; 

その後、

List newList = context.Web.Lists.Add(lc); 
newList.ContentTypesEnabled = true; 
newList.OnQuickLaunch = true; 
newList.Update(); 
context.ExecuteQuery(); 

Sharepointの

コンテキストにリストを追加し、最後に私はContentTypesを割り当てます:

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(); 

しかし、私は新しいリストの設定を表示すると、listTemplateで定義されたビューを持っていません。私はいけない

答えて

0

クライアントオブジェクトモデルを使用して、リストテンプレートからビューを追加する方法あなたのサポートのための

感謝を知っている現在のCOMは、クライアントに定義されたカスタムリストテンプレートからリストを作成することはできないようです。 APIでは、基本テンプレートと、同じテンプレートのフィーチャーIDを共有するので、それから継承するリストテンプレートを区別できないようです。

あなたはCOMから直接リストを作成することをお勧めします。

参考: https://social.technet.microsoft.com/Forums/en-US/c018867b-d8c3-438a-b3f9-959b6d42fbcc/create-list-using-custom-template-using-the-client-object-model?forum=sharepointdevelopmentprevious

関連する問題