Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $siteURL = "https://globomanticsorg.sharepoint.com"
- $adminUrl = "https://globomanticsorg-admin.sharepoint.com"
- $userName = "vlad@globomantics.org"
- # Let the user fill in their password in the PowerShell window
- $password = Read-Host "Please enter the password for $($userName)" -AsSecureString
- # set SharePoint Online credentials
- $SPOCredentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($userName, $password)
- # Creating client context object
- $context = New-Object Microsoft.SharePoint.Client.ClientContext($siteURL)
- $context.credentials = $SPOCredentials
- $web = $context.Web
- $templates = $context.Site.GetCustomListTemplates($web)
- $context.Load($templates)
- $context.ExecuteQuery()
- $template = $templates | Where-Object{ $_.Name -eq "UserswithContent" }
- $lci = New-Object Microsoft.SharePoint.Client.ListCreationInformation
- $lci.Title = "pstest1"
- $lci.TemplateType = $template.ListTemplateTypeKind
- $lists = $context.Web.Lists;
- $context.Load($lists);
- $context.ExecuteQuery();
- $list = $lists.Add($lci)
- $list.Update()
- $context.ExecuteQuery()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement