4

I want to get messages from archive mailbox (enabled In-Place Archive) using Graph API. Could you, please, answere me: how I can do it?

I found similar questions but last answer was 1 year ago. Links to questions:

  • Where you able to achieve this ? – Kunal Valecha Feb 13 '19 at 10:02
  • It is possible to access the In-Place Archive through the MS Graph API. Please see the comment by @Denis here: https://stackoverflow.com/questions/36939501/how-to-get-in-place-archive-mailbox-in-exchange-online-using-office-365-apis – Morten Jun 21 '19 at 08:00
  • Possible duplicate of [How to get In-Place archive mailbox in Exchange Online using Office 365 APIs](https://stackoverflow.com/questions/36939501/how-to-get-in-place-archive-mailbox-in-exchange-online-using-office-365-apis) – Morten Jun 24 '19 at 07:08

2 Answers2

1

You can use a "well-known" folder name

ArchiveMsgFolderRoot

to access the archive mailbox. For example, to get all messages from the Inbox folder inside the archived mailbox use the following query:

GET https://graph.microsoft.com/v1.0/users/<id>/mailFolders/ArchiveMsgFolderRoot/childFolders/Inbox/messages

btw, it uses another predefined folder id (Inbox)

A bit more details on how to work with Archived Mailbox via Graph API

druss
  • 1,820
  • 19
  • 18
-1

First, get the mailFolder list for your account.

GET https://graph.microsoft.com/v1.0/me/mailFolders/

Response:

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users(' ')/mailFolders(id,displayName)",
    "@odata.nextLink": "https://graph.microsoft.com/v1.0/me/mailFolders?$select=id%2cdisplayName&$skip=10",
    "value": [
       ...
        {
            "id": "AAMkADQ5OWMzMGEwLTg4ZjktNDk1Ny05NzFmLsdfZjg4ODU0YzUwYwAuAAAAAACtqDzk9UzLSpZsdesjndr1AQBNzq1HG8BvRYqBQbPeZSPaAAGdwZCCAAA=",
            "displayName": "archive"
        } 
...
    ]
}

Then, use the archive mailboxs's id(AAMkADQ5OWMzMGEwLTg4ZjktNDk1Ny05NzFmLsdfZjg4ODU0YzUwYwAuAAAAAACtqDzk9UzLSpZsdesjndr1AQBNzq1HG8BvRYqBQbPeZSPaAAGdwZCCAAA= on my test case) to get the messages in root folder and sub-folder. Combine them on you client.

GET https://graph.microsoft.com/v1.0/me/mailFolders/{archive mailbox id}/childFolders/messages
GET https://graph.microsoft.com/v1.0/me/mailFolders/{ archive mailbox id}/messages
Seiya Su
  • 1,836
  • 1
  • 7
  • 10
  • 1
    Thank you for answer, I need content of archive mailbox, not "archive" folder. In your case I got items from this folder: [link](http://prntscr.com/lamc11) But I need to get items from this folder (space): [link](http://prntscr.com/lamcos) – Aleksei Gurzhii Oct 26 '18 at 06:53
  • 1
    I have research many docs too, it seems Graph still does not support the In-Place Archive. You have to submit an feature request in the User Voice or up-vote an existing one. "In-place Archive" is not provided for all Office license, so it should has many limitation('https://support.office.com/en-us/article/Outlook-license-requirements-for-Exchange-features-46b6b7c5-c3ca-43e5-8424-1e2807917c99?CorrelationId=185cf2ce-9cd7-43bc-877e-0094d1200f1f&ui=en-US&rs=en-NZ&ad=NZ'). – Seiya Su Oct 26 '18 at 07:08