question

JamesBrown-6203 avatar image
0 Votes"
JamesBrown-6203 asked MillerNicholasNick-5792 published

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

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-mailoffice-js-dev
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Danstan-MSFT avatar image
0 Votes"
Danstan-MSFT answered MillerNicholasNick-5792 published

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=="
         }
     ]
 }





· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@Danstan-MSFT thanks for your answer, but how do I get the user-id?
This is exactly what I am using getSharedPropertiesAsync() for on the client-side - and I'm concerned that getSharedPropertiesAsync() will be deprecated next year.

Is there a way to get the user-id from a message-id, using only the graph?

1 Vote 1 ·

Yes I'm running into the same issue here. We need the user-id to make this api call but how do we get the user-id without getSharedPropertiesAsync? please help!

0 Votes 0 ·