我关注网页(https://docs.microsoft.com/en-us/graph/api/activitystatistics-list?view=graph-rest-beta&tabs=http)并使用MS Graph Explorer(https://developer.microsoft.com/en-us/graph/graph-explorer/preview)作为the image show列出activityStatistics,但始终获得以下信息。
{
"error": {
"code": "UnknownError",
"message": "{"Code":"Forbidden","Message":"Access to the requested resource is forbidden.","Target":"ReadUserAnalyticsV2","Details":[{"Code":"PolicyNotSatisfied","Message":"The following authorization requirements are not satisfied: UserRequireAdvancedMyALicense."}]}",
"innerError": {
"request-id": "0bf68858-17f4-498c-bb2b-c2c185e51e78",
"date": "2020-04-08T18:22:22"
}
}
}
而且我可以尝试使用许可证获取https://graph.microsoft.com/beta/me/analytics/settings检查我是否具有许可证like the images
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#users('5eed83b1-2949-4c9f-b42a-ee9055dfb4fd')/analytics/settings",
"hasLicense": true,
"hasOptedOut": false,
"hasGraphMailbox": true
}
我该如何解决问题?非常感谢。
根据此document,要使Analytics API返回用户结果,当前的用户Analytics设置必须显示有效的MyAnalytics许可证,选择使用MyAnalytics,并具有启用了图表的云托管邮箱。
已签名的用户(/ me)对于GET / me / analytics / settings的响应如下{“ hasGraphMailbox”:是的,“ hasLicense”:是的,“ hasOptedOut”:否}
然后Analytics API将返回结果。如果用户没有许可证,则可以通过PowerShell
分配许可证用户还应该分配“ Microsoft MyAnalytics(Full)”许可证,如下图所示。要分配许可证,您可以导航到portal.office.com。