private void CreateList(ListCreator creator) { var info = new ListCreationInformation(); //Strip leading forward slash if (creator.Url.StartsWith("/")) { creator.Url = creator.Url.Substring(1); } info.Title = creator.Title; info.QuickLaunchOption = creator.QuickLaunchOption; info.TemplateFeatureId = creator.TemplateFeatureId; info.TemplateType = creator.TemplateType; info.Url = creator.Url; info.Description = creator.Description; creator.List = _web.Lists.Add(info); //Get the list's current content types _ctx.Load(creator.List.ContentTypes, c => c.Include (contentType => contentType.Name)); _ctx.Load(creator.List, l => l.Id, l => l.Title); }
private bool retryLoadList(ListCreator creator) { try { creator.List = _web.Lists.GetByTitle(creator.Title); //Get the list's current content types _ctx.Load(creator.List.ContentTypes, c => c.Include (contentType => contentType.Name)); _ctx.Load(creator.List, l => l.Id, l => l.Title); _ctx.ExecuteQueryRetry(); return(true); } catch { return(false); } }