public virtual void UpdateDocumentTemplate(ClientContext ctx) { if (DocumentTemplateUrl != null) { List = ctx.Web.Lists.GetByTitle(Title); List.ContentTypesEnabled = true; List.Update(); ctx.Load(List.ContentTypes); ctx.ExecuteQueryRetry(); List.ContentTypes[0].DocumentTemplate = DocumentTemplateUrl.Replace("{@WebServerRelativeUrl}", ctx.Web.ServerRelativeUrl); List.ContentTypes[0].Update(false); ctx.ExecuteQueryRetry(); } }
public virtual void UpdateDocumentTemplate(ClientContext ctx, Web web) { if (!string.IsNullOrEmpty(DocumentTemplateUrl)) { List = web.Lists.GetByTitle(Title); List.ContentTypesEnabled = true; List.Update(); ctx.Load(List.ContentTypes); ctx.ExecuteQueryRetry(); List.ContentTypes[0].DocumentTemplate = DocumentTemplateUrl.Replace("{@WebServerRelativeUrl}", web.ServerRelativeUrl); List.ContentTypes[0].Update(false); ctx.ExecuteQueryRetry(); } }