I cant create a List based in a Custom List Template from Sharepoint 2013. The list is created correctly but not contain the views that is defined in the list template.
In my code, first I get the listTemplate:
ListTemplateCollection ltc = context.Site.GetCustomListTemplates(context.Web);
context.Load(ltc);
context.ExecuteQuery();
ListTemplate listTemplate = ltc.FirstOrDefault(n => n.Name == "name");
Then create the ListCreationInformation object:
ListCreationInformation lc = new ListCreationInformation();
lc.Title = GetNameDocumentLibrary(nombreBibliotecaDocumentos);
lc.TemplateType = listTemplate.ListTemplateTypeKind;
lc.TemplateFeatureId = listTemplate.FeatureId;
lc.QuickLaunchOption = QuickLaunchOptions.DefaultValue;
Then, Add the list to Context Sharepoint
List newList = context.Web.Lists.Add(lc);
newList.ContentTypesEnabled = true;
newList.OnQuickLaunch = true;
newList.Update();
context.ExecuteQuery();
And Finally I Assign the 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();
But when I Show the configuration of my new list, not have the views that is defined in listTemplate.
I dont know how add the views from list template using client object model
Thanks for your support