Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ListTemplateCollection templates = context.Site.GetCustomListTemplates(context.Web);
context.Load(templates);
context.ExecuteQuery();
log.Info("Templates Loaded");
// Initialize list or library creation info
var template = templates.First(listTemp => listTemp.Name == "<name of template>");
var listCreationInfo = new ListCreationInformation();
listCreationInfo.Title = LibName;
listCreationInfo.Description = LibName;
listCreationInfo.ListTemplate = template;
listCreationInfo.TemplateFeatureId = template.FeatureId;
listCreationInfo.TemplateType = template.ListTemplateTypeKind;
// Add Document Library to site
LibNew = context.Web.Lists.Add(listCreationInfo);
context.ExecuteQuery();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.