Created
April 24, 2014 18:30
-
-
Save jeffpatton1971/11264640 to your computer and use it in GitHub Desktop.
Create Sharepoint Online Site
This file contains hidden or 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
# | |
# Need this | |
# http://www.microsoft.com/en-ie/download/confirmation.aspx?id=35585 | |
# | |
Add-Type -Path "c:\folder\Microsoft.SharePoint.Client.dll" | |
Add-Type -Path "c:\folder\Microsoft.SharePoint.Client.Runtime.dll" | |
$siteUrl = "https://tenant.sharepoint.com/sites/things" | |
$credentials = (Get-Credential) | |
$ClientContext = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl) | |
$SharepointCredentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($credentials.UserName, $credentials.GetNetworkCredential().Password) | |
$ClientContext.Credentials = $SharepointCredentials | |
$webCreationInformation = New-Object Microsoft.SharePoint.Client.WebCreationInformation | |
$webCreationInformation.Url = "site1" | |
$webCreationInformation.Title = "Site 1" | |
$webCreationInformation.WebTemplate = "STS#0" | |
$newSite = $ctx.Web.Webs.Add($webCreationInformation) | |
$ClientContext.Load($newSite) | |
$ClientContext.ExecuteQuery() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment