Amyth
Amyth

Reputation: 1517

Outlook Add-in ErrorInvalidMailboxItemId - Item Id doesn't belong to the current mailbox when downloading attachments

We have an office add-in where we get contents of email, its attachments and send them to our SaaS application to be filed/saved. This works as expected until we try to retrieve attachments of an email from shard mailbox.

This has been working fine, but recently users have reported that they cannot. On testing, we found that, we can get the contents of the shared email (Body) but not the attachments (we can see that the add-in shows the email body and lists all attachments) but there is no attachment content, so when saved in the application, the email is saved with empty files.

The error we get when downloading attachment is:

{
    "error": {
        "code": "ErrorInvalidMailboxItemId",
        "message": "Item Id doesn't belong to the current mailbox."
    }
}

API Call:

https://outlook.office.com/api/v2.0/me/messages/<restId>/attachments/<attachmentId>/?$expand=Microsoft.OutlookServices.ItemAttachment/Item($expand=Microsoft.OutlookServices.Message/attachments

I've already had a look at this post but hasn't helped much. I am testing this on mac but will test on windows.

Any more info regarding this would be helpful.

Upvotes: 0

Views: 2562

Answers (1)

user7823505
user7823505

Reputation:

For items from a Shared Mailbox, use the Shared Properties interface to construct the REST URL, as documented here. To determine whether to use Shared Properties or not, check for requirement set 1.8 as well as the existence of the getSharedPropertiesAsync method. For sample code on how to check for a requirement set, see this documentation.For sample code on how to check for and use the Shared Properties interface, see this other documentation.

Upvotes: 2

Related Questions