Advertisement
Guest User

Allow to Create Child Commutication Site in SharepointOnline

a guest
Mar 6th, 2019
459
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Add references to SharePoint client assemblies and authenticate to Office 365 site
  2. # get from https://www.nuget.org/packages/Microsoft.SharePointOnline.CSOM/16.1.8613.1200
  3. Add-Type -Path "C:\SharePoint Online Management Shell\Microsoft.SharePoint.Client.dll"
  4. Add-Type -Path "C:\SharePoint Online Management Shell\Microsoft.SharePoint.Client.Publishing.dll"
  5. Add-Type -Path "C:\SharePoint Online Management Shell\Microsoft.SharePoint.Client.Runtime.dll"
  6.  
  7. $Username = "*@*.onmicrosoft.com"
  8. $Password = ConvertTo-SecureString "*" -asplaintext -force
  9. $Site = "https://*.sharepoint.com/sites/CommunitationSite-Parent/"
  10. $Context = New-Object Microsoft.SharePoint.Client.ClientContext($Site)
  11. $Creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username,$Password)
  12. $Context.Credentials = $Creds
  13.  
  14.  #Create SubSite
  15. $WCI = New-Object Microsoft.SharePoint.Client.WebCreationInformation
  16. $WCI.WebTemplate = "SITEPAGEPUBLISHING#0"
  17. $WCI.Description = "Child"
  18. $WCI.Title = "Child"
  19. $WCI.Url = "CommunitationSite-Child"
  20. $WCI.Language = "1033"
  21. $SubWeb = $Context.Web.Webs.Add($WCI)
  22. $Context.ExecuteQuery()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement