Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Add-Type -Path "c:Program FilesCommon Filesmicrosoft sharedWeb Server Extensions15ISAPIMicrosoft.SharePoint.Client.dll"
- Add-Type -Path "c:Program FilesCommon Filesmicrosoft sharedWeb Server Extensions15ISAPIMicrosoft.SharePoint.Client.Runtime.dll"
- $siteUrl = “https://tenant.sharepoint.com/sites/mysitecollection”
- $username = "username@tenant.onmicrosoft.com"
- $password = Read-Host -Prompt "Enter password" -AsSecureString
- $ctx = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl)
- $credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $password)
- $ctx.Credentials = $credentials
- $webCreationInformation = New-Object Microsoft.SharePoint.Client.WebCreationInformation
- $webCreationInformation.Url = "site1"
- $webCreationInformation.Title = "Site 1"
- $webCreationInformation.WebTemplate = "STS#0"
- $newWeb = $ctx.Web.Webs.Add($webCreationInformation)
- $ctx.Load($newWeb)
- $ctx.ExecuteQuery()
- Write-Host "Title" $newWeb.Title
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement