There is no problem with the authorizations, on the contrary, I get an unauthorized error even though I provide token information. I also get an error(unsupported app only) when I send a request to /_api/web/siteusers with the access token I received from Postman.
Problem of not being able to connect to Sharepoint Online from console application
I could access my SharePoint lists and perform some operations via the console application (.net framework). Since MFA is available here, I created an app password for my account and was connecting via the console app. But for the last few months I've been having trouble connecting and was getting an error saying the username and password were incorrect. I then created an application registration in Azure AD and by creating an access token I can now connect to lists with graph endpoints. but here I cannot access the data at /_api/web/siteusers. Please support me on this matter.
Microsoft 365 and Office SharePoint Development
Microsoft Security Microsoft Graph
2 answers
Sort by: Most helpful
-
-
Reshmee Auckloo 26 Reputation points
2024-03-06T05:24:54.75+00:00 I have tried accessing the siteusers endpoint using clientid and certificate using PnP PowerShell and it works.
The entra app registration has the following permissions
Give it a try to rule out that entra registration has the required permissions.
Connect-PnPOnline reshmeeauckloo.sharepoint.com -ClientId e0c7944e-bccb-40dd-a220-6ebc492c24ca -Tenant contoso.onmicrosoft.com -CertificateBase64Encoded $encodedPfx #Connect-PnPOnline -url $siteurl -Interactive $RestMethodUrl = '/_api/web/siteusers' $users = (Invoke-PnPSPRestMethod -Url $RestMethodUrl -Method Get).Value