Dec 13 2023 08:25 AM - edited Dec 13 2023 08:29 AM
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
Dec 14 2023 12:16 AM
Hi @ellan1537,
the "Get-PnPList : The remote server returned an error: (403) Forbidden" error typically points to a permission issue.
Here are the steps to troubleshoot the issue:
If you are using app permissions with a Registered App in Azure AD, ensure that the app has been granted all necessary SharePoint-related permissions.
authentication - PnP Powershell Sharepoint with app permissions: The remote server returned an error...
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.
Kindest regards,
Leon Pavesic
(LinkedIn)
Dec 14 2023 03:40 PM
SolutionDec 14 2023 03:40 PM
Solution