Office365 Reports via Graph API

陌路散爱 提交于 2021-01-29 10:32:25

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!