Forum Discussion
manofiron068
Jan 27, 2020Copper Contributor
Handling ExecuteQuery 403 Error in Powershell script
Hey everyone, I am a rookie for PowerShell and currently working on a script to build up a connection from a CSV file to SharePoint list. I get this error below even it runs ExecuteQuery() when I...
Erick A. Moreno R.
Feb 21, 2020Iron Contributor
manofiron068 Try modifying your script as follows.
#site contents access
$cxt = New-Object Microsoft.SharePoint.Client.ClientContext($Site)
$cxt.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($credentials.UserName,$credentials.Password) #creds for the context to avoid 403 permissions error
$web = $cxt.Web