问题
I am trying to fetch various usage reports for Office365 using Graph API. I created an Azure AD app and added the following permissions:
- Read All Usage Reports (Reports.Read.All)
- Read Directory Data (Directory.Read.All)
Admin also gave a consent.
I am experiencing a problem when I'm trying to fetch different usage reports. The following response is returned
{
"error": {
"code": "UnknownTenantId",
"message": "We do not recognize this tenant ID {actual tenant id}. Please double-check the tenant ID and try again.",
"innerError": {
"request-id": "545e7b8e-95b1-49bd-8d14-e47bf8e81cab",
"date": "2018-06-01T11:36:32"
}
}
}
However, other endpoints are functional, e.g. I am able to fetch a list of users and organization info.
We just purchased an Office365 subscription today for testing and development. Is there a delay before report endpoints can be accessed? Or does anybody have an idea what might be the problem?
Edit:
Some of the endpoints that are returning the "UnknownTenantId" error are:
https://graph.microsoft.com/v1.0/reports/getSkypeForBusinessActivityUserDetail(period='D7')
https://graph.microsoft.com/v1.0/reports/getOffice365ActiveUserDetail(period='D7')
https://graph.microsoft.com/v1.0/reports/getOneDriveActivityUserDetail(period='D7')
Endpoints that return valid responses:
https://graph.microsoft.com/v1.0/users
https://graph.microsoft.com/v1.0/subscribedSkus
https://graph.microsoft.com/v1.0/organization
The only thing that I'm explicitly setting in requests is an Authorization header, in the following form:
Authorization: Bearer token_value
来源:https://stackoverflow.com/questions/50642799/office365-reports-via-graph-api