Is Office.context.mailbox.item.getSharedPropertiesAsync() to be deprecated in 2022?

James Brown 6 Reputation points
2021-10-12T14:11:51.277+00:00

My Outlook add-in imports emails into a database and I am migrating it from using the Outlook REST API to Microsoft Graph as per this notice:
https://developer.microsoft.com/en-us/graph/blogs/outlook-rest-api-v2-0-deprecation-notice/

For an email in a shared mailbox, the add-in currently calls getSharedPropertiesAsync() on the client-side to retrieve the targetMailbox, that is then sent to the server-side to retrieve the shared Message with:
message = await graphClient.Users[targetMailbox].Messages[messageId].Request().GetAsync();

I'm aware that in order to call getSharedPropertiesAsync(), you must first retrieve a REST access token using:
mailbox.getCallbackTokenAsync({ isRest: true }

Therefore, is getSharedPropertiesAsync() part of the REST API that is to be deprecated in 2022?
Is there an alternative way to access an email Message (using a Message ID) in a shared mailbox using only the Graph in server-side code?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,573 questions
JavaScript API
JavaScript API
An Office service that supports add-ins to interact with objects in Office client applications.
866 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Danstan Onyango 3,741 Reputation points Microsoft Employee
    2021-10-15T07:05:25.917+00:00

    Answering the Graph API bit of the question.

    With Graph API, for a shared mailbox, you can access the message using the message-id and the user-id of the owner of the mails using Get Message.
    When using delegated permissions you will need Mail.Read.Shared permission added to your app. See this thread for more.

    GET https://graph.microsoft.com/v1.0/users/shared@contoso.com/messages  
      
    {  
        "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('shared%40contoso.com')/messages(id)",  
        "value": [  
            {  
                "@odata.etag": "W/\"CQAAA...\"",  
                "id": "AQMk...AIf-wAAAA=="  
            },  
            {  
                "@odata.etag": "W/\"CQAAABYA...\"",  
                "id": "AQM...AAAIJPwAAAA=="  
            }  
        ]  
    }