Restoring Data from Folders to Another Mailbox
You can restore backed-up data from an organization mailbox folder with the specified ID to another mailbox.
Request
POST https://<hostname>:4443/v6/RestoreSessions/{restoreSessionId}/organization/mailboxes/{mailboxId}/folders/{folderId}/restoreTo |
Request Headers
The request header must contain an authorization token of the current session.
Request Parameters
The following parameters must be specified in the URL of the request:
Parameter | Type | Description |
---|---|---|
restoreSessionId | string | Specifies the identification number of the restore session. For more information on how to get this parameter, see Getting Restore Sessions. |
mailboxId | string | Specifies the identification number of the mailbox. For more information on how to get this parameter, see Getting Mailboxes. |
folderId | string | Specifies the identification number of the folder. For more information on how to get this parameter, see Getting Mailbox Folders. |
Request Body
To restore backed-up data from a mailbox folder to a different mailbox on the production Exchange server, the request body must contain the following properties:
Property | Type | Description |
---|---|---|
casServer | string | Specifies the Microsoft Exchange server with Client Access Server (CAS) role. The mailbox folder data will be restored to a specified mailbox server. Example: "casServer": "outlook.office365.com". |
mailbox | string | Specifies the email address of the mailbox to which you want to restore mailbox folder data. Example: "mailbox": "djohnes@northsupport.onmicrosoft.com". |
folder | string | Specifies the mailbox folder to which you want to restore mailbox folder data. Example: "folder": "RestoreFolder". |
officeRegion | string | Specifies the region of the target Exchange organization. The following values are available:
|
officeOrganizationName | string | Specifies the name of the target Exchange organization. |
userName | string | Specifies the user name that you want to use for authenticating to the Exchange organization. Example: "userName": "djohnes@northsupport.onmicrosoft.com". |
userPassword | string | Specifies the password of the user account that you want to use for authenticating to the Exchange organization. Example: "userPassword": "paSSw0rd". |
changedItems | boolean | If set to true, indicates that all versions of mailbox folder items will be restored. Example: "changedItems": true. |
deletedItems | boolean | If set to true, indicates that deleted mailbox folder items will be restored. Example: "deletedItems": true. |
markRestoredAsUnread | boolean | If set to true, indicates that restored mailbox folder data will be marked as unread. Example: "markRestoredAsUnread": false. |
excludeDrafts | boolean | If set to true, indicates that Drafts mailbox folder will not be restored. Example: "excludeDrafts": false. |
excludeDeletedItems | boolean | If set to true, indicates that Deleted Items mailbox folder will not be restored. Example: "excludeDeletedItems": false. |
excludeInPlaceHoldItems | boolean | If set to true, indicates that preserved items of mailbox folders placed on In-Place Hold will not be restored. Example: "excludeInPlaceHoldItems": true. |
excludeLitigationHoldItems | boolean | If set to true, indicates that preserved items of mailbox folders placed on Litigation Hold will not be restored. Example: "excludeLitigationHoldItems": true. |
userCode | string | Specifies the authentication code. For more information on how to get a device code, see Getting Device Code. This property is required if you want to use a device code for data restore. |
applicationId | string | An identification number of the Azure AD application that you want to use for a restore. |
applicationCertificate | base64 | Specifies the SSL certificate configured for the Azure AD application that you want to use for data restore. You must provide the certificate as a Base64 string. For more information on how to obtain a Base64 string, see Converting Certificate to Base64 String. |
applicationCertificatePassword | string | A password for the SSL certificate being used. |
impersonationAccountName | string | Specifies a user name of the account that will be used as a Microsoft Exchange account to restore data from an organization mailbox folder. This property is required if you want to use an application certificate for data restore. Use this property only with the applicationCertificate property. |
Converting Certificate to Base64 String
If you want to use a certificate to access an Azure AD application, you must provide the certificate as a Base64 string. To obtain a Base64 string, perform the following steps:
- Get the certificate content from a PFX file.
- Convert the certificate to a Base64 string.
To do this, you can use the following PowerShell cmdlets:
$pfx_cert = get-content '<path_to_cert>' -Encoding Byte [System.Convert]::ToBase64String($pfx_cert) | Out-File '<path_to_file>' |
where:
- <path_to_cert> — path to the PFX file that you want to convert to a Base64 string.
- <path_to_file> — path to a file that that will contain the resulting Base64 string. You will be able to copy the Base64 string from the file and provide the string in the body of a request to Veeam Backup for Microsoft 365 REST API.
For example:
$pfx_cert = get-content 'C:\cert.pfx' -Encoding Byte [System.Convert]::ToBase64String($pfx_cert) | Out-File 'C:\base64.txt' |
Response
The server returns the following response to the client.
Response Codes
A successfully completed operation returns a response code 200 OK.
Response Headers
The response to this request contains the following headers. The response may also include additional standard HTTPS headers.
Header | Description |
---|---|
Content-length | The length of the response body. |
Content-type | The media type and syntax of the response body message for the requests with the export and save actions: application/octet-stream. The media type and syntax of the response body message for the requests with the restore and send actions: null. |
Response Body
In the response body, the server returns information about operation results.
The response body for the restore operation contains the following properties:
Property | Type | Description |
---|---|---|
createdItemsCount | integer | Number of missing items restored from the backup. |
mergedItemsCount | integer | Number of changed items restored from the backup. |
failedItemsCount | integer | Number of items for which the restore operation failed. |
skippedItemsCount | integer | Number of items that were not changed or missing in the original location. Such items are skipped during the restore operation. |
Example
The example shows how to restore all versions of organization mailbox folder data to a different mailbox on the production Exchange server.
Request: POST https://abc.tech.local:4443/v6/RestoreSessions/380d7caf-6294-4a33-b50a-b8aeb13af58c/organization/mailboxes/9e9b7199-f547-467a-b580-9d283a75eaad/folders/AAAAAKGE4dIvQUtGjuSnq8JTHAgBAPliTMf_6DxPiJ6TGYB9CqAAAAAAAQ4AAA==/restoreTo
Request Header: Authorization: Bearer <Access-Token>
Request Body: { "casServer": "outlook.office365.com", "mailbox": "djohnes@westsupport.onmicrosoft.com", "folder": "Contacts", "userName": "djohnes@westsupport.onmicrosoft.com", "userPassword": "paSSw0rd", "changedItems": true, "deletedItems": false, "markrestoredAsunread": true }
Response: 200 OK
Response Body: { "createdItemsCount": 3, "mergedItemsCount": 2, "failedItemsCount": 0, "skippedItemsCount": 1 } |