Forum Discussion
Get-PnpListItem from Sharepoint Online list giving 401 error
Hi jlentz927,
The 401 error typically is there when there is an issue with authentication or authorization. You can troubleshoot the error following these steps
Verify Azure AD authentication: check if the Azure AD authentication setup is accurate. Check the validity of the Azure AD application registration and permissions. You can also try to re-register the application and configure the necessary permissions to ensure they have not expired or been modified.
Check SharePoint Online permissions: check that the account used for authentication has appropriate permissions in SharePoint Online. Verify that it has at least read access to the relevant site and list where the Get-PnpListItem cmdlet is being used.
Validate SharePoint Online URL: Double-check the accuracy of the URL used in the Connect-PnPOnline cmdlet. Ensure it correctly points to the intended SharePoint Online site and subsite where the DIDs list is located. Alao, ensure the URL is accessible and not restricted by network or firewall.
Test different authentication methods: Explore alternative authentication methods if you are currently using the Az module. For example, you can use the SharePoint Online Management Shell and the Connect-SPOService cmdlet to connect to SharePoint Online instead.
- Update PnP PowerShell module: Keep your PnP PowerShell module up to date.
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