Forum Discussion

ellan1537's avatar
ellan1537
Iron Contributor
Dec 13, 2023

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

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

  • ellan1537's avatar
    ellan1537
    Dec 14, 2023
    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.
  • 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.

    • ellan1537's avatar
      ellan1537
      Iron Contributor
      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.

Resources