Guest User

Untitled

a guest
Mar 15th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. # Import CSOM libraries for the SP upload part of the script
  2. Add-Type -Path “C:Program FilesCommon Filesmicrosoft sharedWeb Server Extensions16ISAPIMicrosoft.SharePoint.Client.dll”
  3. Add-Type -Path “C:Program FilesCommon Filesmicrosoft sharedWeb Server Extensions16ISAPIMicrosoft.SharePoint.Client.Runtime.dll”
  4.  
  5. # Specify connection details
  6. $SiteUrl = "https://xx.sharepoint.com/sites/site"
  7. $UserName = "xxx@xxx.onmicrosoft.com"
  8. $SecurePassword = ConvertTo-SecureString "****" -AsPlainText -Force
  9.  
  10. # Bind to site collection
  11. $ClientContext = New-Object Microsoft.SharePoint.Client.ClientContext($SiteUrl)
  12. $credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName, $SecurePassword)
  13. $ClientContext.Credentials = $credentials
  14. $ClientContext.ExecuteQuery()
  15.  
  16. # From the SC, get the first web (i.e. the one implicit in /)
  17. $rootWeb = $ClientContext.Web
  18. $ClientContext.Load($rootWeb)
  19. $ClientContext.ExecuteQuery()
  20.  
  21. $rootWeb.Title
  22. $rootWeb.MasterUrl
  23. $rootWeb.RequestAccessEmail
Add Comment
Please, Sign In to add comment