示例#1
0
 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();
     }
 }
示例#2
0
 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();
     }
 }