To connect to SharePoint Online with Powershell 7 #12108
Labels
Issue-Question
ideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a
Resolution-Answered
The question is answered.
I am not able to connect to SharePoint Online Site collection with Powreshell 7.I am getting below error -The remote server returned an error: (400) Bad Request.
Add-Type -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
$userName = "***"
$password = ConvertTo-SecureString "" -AsPlainText -Force
$webURL="https://test.sharepoint.com/sites/test/"
$Context=New-Object Microsoft.SharePoint.Client.ClientContext($webURL)
$Context.Credentials=New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username,$password)
$Web=$context.Web
$Context.Load($web)
$Context.executeQuery()
Write-host $Web.URL
The text was updated successfully, but these errors were encountered: