Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Import CSOM libraries for the SP upload part of the script
- Add-Type -Path “C:Program FilesCommon Filesmicrosoft sharedWeb Server Extensions16ISAPIMicrosoft.SharePoint.Client.dll”
- Add-Type -Path “C:Program FilesCommon Filesmicrosoft sharedWeb Server Extensions16ISAPIMicrosoft.SharePoint.Client.Runtime.dll”
- # Specify connection details
- $SiteUrl = "https://xx.sharepoint.com/sites/site"
- $UserName = "xxx@xxx.onmicrosoft.com"
- $SecurePassword = ConvertTo-SecureString "****" -AsPlainText -Force
- # Bind to site collection
- $ClientContext = New-Object Microsoft.SharePoint.Client.ClientContext($SiteUrl)
- $credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName, $SecurePassword)
- $ClientContext.Credentials = $credentials
- $ClientContext.ExecuteQuery()
- # From the SC, get the first web (i.e. the one implicit in /)
- $rootWeb = $ClientContext.Web
- $ClientContext.Load($rootWeb)
- $ClientContext.ExecuteQuery()
- $rootWeb.Title
- $rootWeb.MasterUrl
- $rootWeb.RequestAccessEmail
Add Comment
Please, Sign In to add comment