Last active
January 25, 2018 06:22
-
-
Save AsishP/864d19ecb61c57ce317bd7d3fda87e1c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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