Graph API Developer–Programmatically get the Outlook categories defined for the user using Graph API

Well, we use Outlook/Office 365 a lot and sure most of them uses Categories.

Le Cafe Central de Deva - Deva blogs

Traditionally, you might have used MAPI/Outlook Object Model/EWS API to retrieve these categories. This time, lets we use Microsoft Graph API to programmatically get the Outlook categories that have been defined for the user.

First i make the Request:

GET https://graph.microsoft.com/v1.0/me/outlook/masterCategories

It gets me the following response.

Response body:

{
     "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users(g45h67-8365-474b-80cc-75678624fddcbd')/outlook/masterCategories",8
     "value": [
         {
             "id": "98f4fcf5-7c1f-4c5b-8be6-97b2be0fa8bc",
             "displayName": "Red Category",
             "color": "preset0"
         },
         {
             "id": "ee71f200-2a3d-457a-a25d-1f84fd44b507",
             "displayName": "Orange Category",
             "color": "preset1"
         },
         {
             "id": "719c36d2-f40e-48d7-ab22-7fe485080d5c",
             "displayName": "Yellow Category",
             "color": "preset3"
         },
         {
             "id": "bf99f4e2-fd56-4897-b374-1a0461f9d0ea",
             "displayName": "Green Category",
             "color": "preset4"
         },
         {
             "id": "ed1156cb-0fbc-4974-b264-400fe1f5b882",
             "displayName": "Blue Category",
             "color": "preset7"
         },
         {
             "id": "6b8efc3e-ee62-4715-82f3-b92eea0a80dc",
             "displayName": "Purple Category",
             "color": "preset9"
         }
     ]

}

Please note that, if successful, this method returns a 200 OK response code and collection of outlookCategory objects in the response body.

Hope this helps.

Comments

  • Anonymous
    March 08, 2019
    Hey; that's a very cool article about API developer and how they can be used to get the outlook categories for the users can be drawn, keep posting and updating and thanks for sharing.
    • Anonymous
      March 08, 2019
      Thank you Geek Squads!!