Microsoft Graph API list categories for shared mailbox

Joshua Gentes 106 Reputation points
2020-10-02T15:20:42.277+00:00

Thank you for your time and attention. I am interested in locating where to view the categories list for a shared mailbox. I have an app registered, it has permissions MailboxSettings.ReadWrite, and my app is using https://learn.microsoft.com/en-us/graph/api/outlookuser-list-mastercategories?view=graph-rest-1.0&tabs=http as a reference for how view all existing categories, but the response shows the default category list, instead of the ones I see if I click on a message in my outlook client and then click on the "categories" menu button. The end goal is to dynamically manage categories (create/update/remove) associated with messages. I have tested the "update message api" https://learn.microsoft.com/en-us/graph/api/message-update?view=graph-rest-1.0&tabs=http and it will update the categories attribute as expected, however I wish for the categories to have a corresponding color scheme beyond just the default "grey" that gets assigned if a category does not already exist. It is my assumption then, that in order for these categories to have the appropriate color scheme ("preset#"), I need to modify the known categories for the mailbox, which is why I want to list the currently known ones, so I may apply modifications (creating new ones, updating color of existing ones, removing ones that are no longer necessary). I would appreciate a reference point on where I am able to get the necessary education to complete this workflow. Best!

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
18,715 questions
{count} vote

3 additional answers

Sort by: Most helpful
  1. JamesTran-MSFT 36,056 Reputation points Microsoft Employee
    2020-10-02T21:39:17.29+00:00

    @Joshua Gentes
    I was able to create, update, and remove categories within Outlook using the below API calls.

    I retrieved the whole list of categories using the below GET call and highlight my test category. For more info.

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

    29860-getcategory.jpg

    I updated the existing category preset, however, you can't modify the displayName property once you have created the category. For more info.

    PATCH https://graph.microsoft.com/v1.0/me/outlook/masterCategories/6e857fa6-9c27-467b-95f7-08fb912fbf9d  
    Request Body:  
    {  
        "color": "preset9"  
    }  
    

    29965-patchcolor.jpg

    I created a new category and deleted my existing test categories:

    Create a new category  
    POST https://graph.microsoft.com/v1.0/me/outlook/masterCategories  
      
    Delete categories:  
    DELETE /me/outlook/masterCategories/{id}  
    

    29937-createnew.jpg

    Create Outlook Category
    Delete Outlook category

    I hope this helps! If you have any other questions, please let me know.
    Thank you again for your time and patience throughout this issue.


  2. Joshua Gentes 106 Reputation points
    2020-10-05T12:35:03.357+00:00

    This is perfect documentation,Thank you. I am looking for a user that is not "me" (it is a shared mailbox); pardon if I was not clear.

    from: https://learn.microsoft.com/en-us/graph/api/outlookuser-list-mastercategories?view=graph-rest-1.0&tabs=http
    GET /users/{id|userPrincipalName}/outlook/masterCategories

    I was using the "id" from /users to locate the shared mailbox, which from this appears as if it is appropriate.

    //EDIT
    Trying to find ms graph auth token
    performing GET https://graph.microsoft.com/v1.0/users/SHARED_MAILBOX_USER_ID/outlook/masterCategories
    {"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('...')/outlook/masterCategories", "value": [{"id": "...", "displayName": "Red category", "color": "preset0"}, {"id": "...", "displayName": "Orange category", "color": "preset1"}, {"id": "...", "displayName": "Yellow category", "color": "preset3"}, {"id": "...", "displayName": "Green category", "color": "preset4"}, {"id": "...", "displayName": "Blue category", "color": "preset7"}, {"id": "...", "displayName": "Purple category", "color": "preset8"}]}

    When I click on an email letter within the Inbox of the SharedMailbox, and select from one of the top menus "categories > manage categories", I see the following.
    30186-screen-shot-2020-10-05-at-84809-am.png


  3. Joshua Gentes 106 Reputation points
    2020-10-19T13:02:27.463+00:00

    @JeffYang-MSFT I suggest that you do not reference anyone to that site. It's been over a week and there has been no replies.

    0 comments No comments