Why no response to Graph API reports query?

David Pettitt 51 Reputation points
2021-03-09T22:39:29.153+00:00

I am attempting to get reports data out of the Graph API. I get nothing back as a response. No error, no data. I have tried several different endpoints, all with the same result.

Example URL: https://graph.microsoft.com/1.0/reports/getSharePointSiteUsageDetail(period='D7')

The same issue occurs whether I'm using PowerShell Invoke-WebRequest, or the Graph Explorer site.

It can't be a permissions issue, as there is no error about permissions, and my account has the necessary 'Reports.Read.All' permission.

What is going on?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,586 questions
0 comments No comments
{count} vote

Accepted answer
  1. Danstan Onyango 3,741 Reputation points Microsoft Employee
    2021-09-03T04:56:12.047+00:00

    This endpoint returns CSV data that Graph Explorer trys to parse as a JSON thus resulting in the error. Even if the response was 200, Graph Explorer will fail and display 0 as the status code because it does not yet support CSV data in response.

    You can test this on Postman which will handle and display the CSV data/content type. See screenshot below.

    128971-reports-getsharepoint-usage-postman.png

    There seems to be an issue with the fields Display Name and Site Url which is asked in this thread - getEmailActivityUserDetail(date=xxxx) was working but now is returning wrong values in UserPrincipal Identity, If you see the same thing, you can upvote the question.

    1 person found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Deva-MSFT 2,256 Reputation points Microsoft Employee
    2021-03-15T14:03:12.397+00:00

    What happens if you make the call in Microsoft Graph Explorer for the same user? Which HTTP code that you receive?

    For delegated permissions to allow apps to read service usage reports on behalf of a user, the tenant administrator must have assigned the user the appropriate Azure AD limited administrator role. Refer the documentation.


  2. David Pettitt 51 Reputation points
    2021-04-28T22:24:40.92+00:00

    Based on a different question here on the docs site (thanks for following this question, anonymous user, so that I could find your question) it appears that the /beta/ endpoint is functional, as long as ?$format=application/json is appended to the end of the query.

    eg: https://graph.microsoft.com/beta/reports/getSharePointSiteUsageDetail(period='D7')?format=application/json

    This is sufficient for now, but it sure would be nice if MS either fixed the 1.0 endpoint, or updated their documentation to mention that only the beta endpoint actually works.

    0 comments No comments