Maintain control of your Microsoft 365 data
Post Reply
disk91
Influencer
Posts: 24
Liked: 2 times
Joined: Feb 18, 2021 9:42 am
Full Name: Paul
Contact:

Restore Mailbox returns strange response

Post by disk91 »

Hello,
I'm working on Mailbox restore API https://<hostname>:4443/v5/RestoreSessions/{restoreSessionId}/Organization/Mailboxes/action

Specifying one uniq Mailbox to be restored, this one is from a deleted O365 user.

1) The action returns for this mailbox

Code: Select all

"status": "Failed",
"error": "Mailbox processing skipped. Reason: UnresolvedNoEmailsFound"
What does that means ? The Inbox folder of this mailbox, inside the backup, contains email.

2) The result of this action returns an unexpected content listing all the account mailbox and actions on each of them when the request was concerning a single mailbox:
request

Code: Select all

{"restoreTo":{
   "mailbox":[{"Id":"d9fXXX00-03d7-4XX1-8900-b06dc77XXXXX"}],
   "userCode":"DWJUXXX",
   "changedItems":false,
   "deletedItems":false,
   "markrestoredAsunread":false,
   "excludeDrafts":false,
   "excludeDeletedItems":false,
   "excludeInPlaceHoldItems":false,
   "excludeLitigationHoldItems":false,
   "recentItemRestorePeriod":30,
   "skipUnresolved":true
}} 
Return is

Code: Select all

{
  "status": "Failed",
  "details": [
    {
      "mailbox": {
        "id": "a06d98a5-...",
        "name": "All Company",
        "email": "allcompany@xxx.onmicrosoft.com",
        "isArchive": false,
        "isPublic": false,
        "status": "Success",
        "details": {
          "createdItemsCount": 0,
          "mergedItemsCount": 0,
          "failedItemsCount": 0,
          "skippedItemsCount": 1,
          "warnings": []
        }
     },
    {
      "mailbox": {
        "id": "c49f566b-....",
        "name": "xxx",
        "email": "admin@xxxx.onmicrosoft.com",
        "isArchive": false,
        "isPublic": false,
        ....
      },
      "status": "Success",
      "details": {
        "createdItemsCount": 0,
        "mergedItemsCount": 0,
        "failedItemsCount": 0,
        "skippedItemsCount": 84,
        "warnings": []
      }
    },
    ...
    {
      "mailbox": {
        "id": "d9fXXX00-03d7-4XX1-8900-b06dc77XXXXX",  /* The mailbox concerned */
        "name": "kenny southpark",
        "email": "kenny@xxxxx.onmicrosoft.com",
        "isArchive": false,
        "isPublic": false,
       ...
      "status": "Failed",
      "error": "Mailbox processing skipped. Reason: UnresolvedNoEmailsFound"
    }
  ]
} 
disk91
Influencer
Posts: 24
Liked: 2 times
Joined: Feb 18, 2021 9:42 am
Full Name: Paul
Contact:

Re: Restore Mailbox returns strange response

Post by disk91 »

Concerning the second point The reason was the use of "mailbox" instead of "mailboxes" in the request body.
That said, it is really dangerous to launch a global restore of all Mailbox in case the API is not correctly implemented in my point of view.

The point 1) is still a valid question.
Polina
Veeam Software
Posts: 2994
Liked: 711 times
Joined: Oct 21, 2011 11:22 am
Full Name: Polina Vasileva
Contact:

Re: Restore Mailbox returns strange response

Post by Polina »

Hi Paul,

On #1: To restore a mailbox, you need the user to be present in O365, because VBO cannot restore user accounts. So, first, create a user account in O365 and then restore, or restore the deleted user's mailbox to a different existing account.

On #2, for an individual restore, you need to specify a mailbox ID using the (POST) https://<hostname>:4443/v5/RestoreSessions/{restoreSessionId}/Organization/Mailboxes/{mailboxId}/action resource. Would you consider this API incorrect?

Thanks!
disk91
Influencer
Posts: 24
Liked: 2 times
Joined: Feb 18, 2021 9:42 am
Full Name: Paul
Contact:

Re: Restore Mailbox returns strange response

Post by disk91 »

Thank you for your answers.
Point #1 ok

Point #2 is more a question of safety, by mistyping the field name, you start a restore of all the company mailboxes. This can really dangerous side effects.
nielsengelen
Product Manager
Posts: 5643
Liked: 1187 times
Joined: Jul 15, 2013 11:09 am
Full Name: Niels Engelen
Contact:

Re: Restore Mailbox returns strange response

Post by nielsengelen »

On point 2, this is actually a matter of validation of what a customer would enter in the field name. On the other hand, I don't think you'll build an application where you allow the customer to understand the mailbox ID to perform the restore but rather present them as a list with action options?
Personal blog: https://foonet.be
GitHub: https://github.com/nielsengelen
disk91
Influencer
Posts: 24
Liked: 2 times
Joined: Feb 18, 2021 9:42 am
Full Name: Paul
Contact:

Re: Restore Mailbox returns strange response

Post by disk91 »

2) Not a big issue on the system I'm building working as you described. But for people using the API for a single use, there is a risk of large impact of a simple human error.

3) I still have a problem with the multi mailbox restore API :
The following call
<code>{"restoreTo":{"mailboxes":[{"Id":"d9fb3300-XXXX-XXXX-8900-b06dc7772877","email":"kenny@xxxx.onmicrosoft.com","name":"kenny southpark"}],"userCode":"CKVRS4XXX","changedItems":false,"deletedItems":false,"markrestoredAsunread":false,"excludeDrafts":false,"excludeDeletedItems":false,"excludeInPlaceHoldItems":false,"excludeLitigationHoldItems":false,"recentItemRestorePeriod":30,"skipUnresolved":true}} </code>
Returns
<code>
"status": "Failed",
"error": "Mailbox processing skipped. Reason: UnresolvedNoEmailsFound"
</code>
But the same MailboxID is restored successfully with the https://<hostname>:4443/v5/RestoreSessions/{restoreSessionId}/Organization/Mailboxes/{mailboxId}/action endpoint

Any reason why ?
disk91
Influencer
Posts: 24
Liked: 2 times
Joined: Feb 18, 2021 9:42 am
Full Name: Paul
Contact:

Re: Restore Mailbox returns strange response

Post by disk91 »

OK,
I think I understand : the Multi-Restore can only be applied on "RestoreOnOrigin" so the O365 account can't be detroyed and re-created to have it working. This is why it was not able to rebuild the mailbox in the previous exemple. The error message could be different like UnresolvedNoMailboxIDFound instead of email because the email exists.
By the way, this bulk restore could search on email instead of ID also to allow mailbox re-creation.
Problem solved.
Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests