1
votes

I am using the new Office365 REST API: https://msdn.microsoft.com/en-us/office/office365/api/api-catalog and am successfully querying calendar events, which include their categories as a list of strings: https://outlook.office365.com/api/v1.0/me/events

How do I query the global list of all categories associated with a calendar, as well as the colour associated with each category? The colours I setup via the Outlook client appear to persist across client instances, and yet I can't find a way to access these data via the API.

2

2 Answers

0
votes

Great question! You can't access that information currently with the REST APIs, but it's a great idea.

If you're curious, all the gory details on how the category list is stored are documented in [MS-OXOCFG].

0
votes

You can actually do this now with the current version of the Graph API. If you want to list the categories that have been defined for a user, you can use either of these endpoints:

GET /me/outlook/masterCategories
GET /users/{id|userPrincipalName}/outlook/masterCategories

and get something like this:

HTTP/1.1 200 OK
Content-type: application/json
Content-length: 727

{
  "@odata.context":"https://graph.microsoft.com/beta/$metadata#users('8ae6f565-0d7f-4ead-853e-7db94c912a1f')/outlook/masterCategories",
  "value":[
    {
      "id":"5a9a6aa8-b65f-4357-b1f9-60c6bf6330d8",
      "displayName":"Red category",
      "color":"preset0"
    },
    {
      "id":"4b1c2495-54c9-4a5e-90a2-0ab0b31987d8",
      "displayName":"Orange category",
      "color":"preset1"
    },
    {
      "id":"de912e4d-c790-4da9-949c-ccd933aaa0f7",
      "displayName":"Yellow category",
      "color":"preset3"
    }
  ]
}