Site feedback

yasi-9251 avatar image
0 Votes"
yasi-9251 suggested

403(Forbidden) Invalid permission error in my SPFx web part when trying to access SharePointSiteUsageDetail with MSGraph

I can GET data from this url in Graph Explorer,but when I try in my SPFx solution it gives me an 403(Forbidden) error:'D30')?$format=application/json


In the package-solution.json file,I set these permissions:

"webApiPermissionRequests": [
{"resource": "Microsoft Graph","scope":"User.ReadBasic.All"},
{"resource": "Microsoft Graph","scope": "sites.Read.All"},
{"resource": "Microsoft Graph","scope": "Reports.Read.All"}]

the code fetching data with MS Graph:

public GetUsageData = (): void => {
.then((msGraphClient: MSGraphClient) => {
const period = 7;
"reports/getSharePointSiteUsagePages(period='D" +
period +
.get((err, report: any, res: any) => {
if (err) {
console.log("Error occured from usage", err);
console.log("Error occured usage data", err);
console.log("Response usage data", res); => {
storageUsedInBytes: result.storageUsedInBytes,
storageAllocatedInBytes: result.storageAllocatedInBytes,
this.setState({ usageDataState: this.allUsage });

I have set the required Report.Read.All permission to "SharePoint Online Client Extensibility Web Application Principal":

I approved the permissions in my sharePoint admin center:


error.png (11.2 KiB)
reportreadall.png (92.4 KiB)
nwe.png (17.7 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

No Solutions

Your Opinion Counts

Share your feedback, or help out by voting for other people's feedback.