I have online sharepoint 2013 subscription and my task is to create one sharepoint site using powerhsell. I have downloaded the Powers-hell for Online sharepoint 2013 for doing power-shell scripting ,But unable to move further. Can any one help me how can I achieve this


The below Powershell script will send the request to SharePoint and your site will be created. Running the script won’t yield any output.

Add-Type -Path "c:\folder\Microsoft.SharePoint.Client.dll"

Add-Type -Path "c:\folder\Microsoft.SharePoint.Client.Runtime.dll"

$siteUrl = “https://mytenant.sharepoint.com/sites/mysitecollection”

$username = "admin@mytenant.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)




Write-Host "Title" $newWeb.Title


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.