0

I follow the web page(https://learn.microsoft.com/en-us/graph/api/activitystatistics-list?view=graph-rest-beta&tabs=http) and use MS Graph Explorer (https://developer.microsoft.com/en-us/graph/graph-explorer/preview) as the image show to List activityStatistics ,but always get the following information .

{
"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"
}
}
}

And I have try license use get https://graph.microsoft.com/beta/me/analytics/settings to check that I have the license 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
}

How can I solve the problem ? Thanks a lot.

Daniel shi
  • 27
  • 3

1 Answers1

0

As per this document, for the analytics API to return results for a user, the current user analytics settings must show a valid MyAnalytics license, be opted in to using MyAnalytics, and have a cloud-hosted mailbox that’s graph-enabled.

The signed user (/me) should have the following response for GET /me/analytics/settings { "hasGraphMailbox": true, "hasLicense": true, "hasOptedOut": false }

Then Analytics API will return results. If the user doesn't have license, you can assign license via PowerShell

The user should also have "Microsoft MyAnalytics(Full)" license assigned as shown in the below picture. To assign a license, you can navigate to portal.office.com. enter image description here

  • I have check GET /me/analytics/settings , that I have the license , list bellow { "@odata.context": "https://graph.microsoft.com/beta/$metadata#users('5eed83b1-2949-4c9f-b42a-ee9055dfb4fd')/analytics/settings", "hasLicense": true, "hasOptedOut": false, "hasGraphMailbox": true } – Daniel shi Apr 12 '20 at 06:25
  • Can you sign in into https://myanalytics.microsoft.com/ and confirm whether you can see the activity data for the user? – Dhivya G - MSFT Identity Apr 13 '20 at 03:51
  • I have updated the answer with the additional license requirements(Microsoft MyAnalytics(Full)). Once you assign the license, it will take a few minutes to reflect the changes. I have attached a screen shot for your reference. – Dhivya G - MSFT Identity Apr 13 '20 at 22:10