SOLVED

Get-PnPList : The remote server returned an error: (403) Forbidden

Iron Contributor

If I connect to the OneDrive site using "connect-pnponline" command and try to do the "Get-PnpList" then I get the "Get-PnPList : The remote server returned an error: (403) Forbidden" error.

 

But if I connect to SharePoint sites, then the "Get-PnpList" command works fine.

 

What can I do to get rid of this forbidden error?

 

$SiteURL = "https://xxxxxx-my.sharepoint.com/personal/xxxxxx"
$ListName= "Documents"

$List = Get-PnPList -Identity $ListName

2 Replies

@ellan1537 

 

Are you trying to connect to your own OneDrive or OneDrive of other user?

 

Try this once and see if it works: Connect to OneDrive using PnP PowerShell 


Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

best response confirmed by ellan1537 (Iron Contributor)
Solution
Although my account has full access to OneDrive and SharePoint sites, my account has been blocked from running Pnp Powershell for OneDrive. With the help of internal teams, my issue has been resolved.
1 best response

Accepted Solutions
best response confirmed by ellan1537 (Iron Contributor)
Solution
Although my account has full access to OneDrive and SharePoint sites, my account has been blocked from running Pnp Powershell for OneDrive. With the help of internal teams, my issue has been resolved.

View solution in original post