-
- Influencer
- Posts: 24
- Liked: 2 times
- Joined: Feb 18, 2021 9:42 am
- Full Name: Paul
- Contact:
API Restoring 0365 Mailbox Folder to a Different O365 Mailbox
Hello,
I want to make a restore a previously deleted mailbox folder into an existing Mailbox on O365.
When calling the API, I'm getting the following response:
"message": "Failed to open mailbox: johndoe@xxxxx.onmicrosoft.com."
The mailbox exists. I'm using the Code to authenticate and the O365 admin user (the one executing the backup)
The API call have body:
{"restoreTo":
{"mailbox":"johndoe@xxxxx.onmicrosoft.com","folder":"restoration","userCode":"XXXXBKK","changedItems":false,"deletedItems":false,"markrestoredAsunread":false}}
What's wrong ?
I want to make a restore a previously deleted mailbox folder into an existing Mailbox on O365.
When calling the API, I'm getting the following response:
"message": "Failed to open mailbox: johndoe@xxxxx.onmicrosoft.com."
The mailbox exists. I'm using the Code to authenticate and the O365 admin user (the one executing the backup)
The API call have body:
{"restoreTo":
{"mailbox":"johndoe@xxxxx.onmicrosoft.com","folder":"restoration","userCode":"XXXXBKK","changedItems":false,"deletedItems":false,"markrestoredAsunread":false}}
What's wrong ?
-
- Product Manager
- Posts: 5797
- Liked: 1215 times
- Joined: Jul 15, 2013 11:09 am
- Full Name: Niels Engelen
- Contact:
Re: API Restoring 0365 Mailbox Folder to a Different O365 Mailbox
You should be able to get more information out of the logs which u can find under %programdata%\veeam\backup365\logs. It looks like a permission issue from the app to the target mailbox.
You may need to enable extended logging to receive full log details (available under the ribbon, support section).
You may need to enable extended logging to receive full log details (available under the ribbon, support section).
Personal blog: https://foonet.be
GitHub: https://github.com/nielsengelen
GitHub: https://github.com/nielsengelen
-
- Influencer
- Posts: 24
- Liked: 2 times
- Joined: Feb 18, 2021 9:42 am
- Full Name: Paul
- Contact:
Re: API Restoring 0365 Mailbox Folder to a Different O365 Mailbox
Thank you for the answer; I agree it seems there is a problem of right. But is there something a documentation explaining how to configure an account to be able to restore into another account ? The Office365 setup has been made by VBO automatically until now.
I encounter the same issue using the Explorer for Microsoft Exchange.
I don't have log directory in the indicated path and I don't see ribbon, support part you mention.
I encounter the same issue using the Explorer for Microsoft Exchange.
I don't have log directory in the indicated path and I don't see ribbon, support part you mention.
-
- Influencer
- Posts: 24
- Liked: 2 times
- Joined: Feb 18, 2021 9:42 am
- Full Name: Paul
- Contact:
Re: API Restoring 0365 Mailbox Folder to a Different O365 Mailbox
Information for other readers:
extended log option is available:
1) Burger Menu in Explorer >> General Options
2) Advance Tab
3) Enable extended logging
extended log option is available:
1) Burger Menu in Explorer >> General Options
2) Advance Tab
3) Enable extended logging
-
- Product Manager
- Posts: 5797
- Liked: 1215 times
- Joined: Jul 15, 2013 11:09 am
- Full Name: Niels Engelen
- Contact:
Re: API Restoring 0365 Mailbox Folder to a Different O365 Mailbox
The full path is C:\ProgramData\Veeam\Backup365\Logs. Are you sure you are checking on the VBO server for the logs? Another option is to export them using the export feature.
Looking at the documentation for restore to another location, it could be the JSON provided is wrong.
Can u try the following:
Looking at the documentation for restore to another location, it could be the JSON provided is wrong.
Can u try the following:
Code: Select all
{
"restoreTo":
{
"mailbox":"johndoe@xxxxx.onmicrosoft.com",
"userCode":"XXXXBKK"
}
}
Personal blog: https://foonet.be
GitHub: https://github.com/nielsengelen
GitHub: https://github.com/nielsengelen
-
- Influencer
- Posts: 24
- Liked: 2 times
- Joined: Feb 18, 2021 9:42 am
- Full Name: Paul
- Contact:
Re: API Restoring 0365 Mailbox Folder to a Different O365 Mailbox
I've tried to remove parameters as proposed and had to add them one after the other, At the end, the Folder parameter is mandatory
{"restoreTo":{"mailbox":"johndoe@xxx.onmicrosoft.com","userCode":"XXXXRHH7","changedItems":false,"deletedItems":false,"markrestoredAsunread":false}}
ERRO[0090] {
"message": "Missing mandatory parameters: Folder."
}
{"restoreTo":{"mailbox":"johndoe@xxx.onmicrosoft.com","userCode":"XXXXRHH7","changedItems":false,"deletedItems":false,"markrestoredAsunread":false}}
ERRO[0090] {
"message": "Missing mandatory parameters: Folder."
}
-
- Product Manager
- Posts: 5797
- Liked: 1215 times
- Joined: Jul 15, 2013 11:09 am
- Full Name: Niels Engelen
- Contact:
Re: API Restoring 0365 Mailbox Folder to a Different O365 Mailbox
Did you already checked within your own logs if you use the full JSON if there is more information?
Personal blog: https://foonet.be
GitHub: https://github.com/nielsengelen
GitHub: https://github.com/nielsengelen
-
- Influencer
- Posts: 24
- Liked: 2 times
- Joined: Feb 18, 2021 9:42 am
- Full Name: Paul
- Contact:
Re: API Restoring 0365 Mailbox Folder to a Different O365 Mailbox
This is all what I get from the API.
Full Json returns the initial problem shown in this thread
Full Json returns the initial problem shown in this thread
-
- Product Manager
- Posts: 5797
- Liked: 1215 times
- Joined: Jul 15, 2013 11:09 am
- Full Name: Niels Engelen
- Contact:
Re: API Restoring 0365 Mailbox Folder to a Different O365 Mailbox
If this is all u can see in the REST API log under C:\ProgramData\Veeam\Backup365\Logs, I suggest you open a support case for more insight. I can't directly see what would be wrong as the JSON payload looks correct and so it is advised to request insight into the process (possibly via a remote call). Could you open a support case and let us know the case ID for future reference?
Personal blog: https://foonet.be
GitHub: https://github.com/nielsengelen
GitHub: https://github.com/nielsengelen
-
- Influencer
- Posts: 24
- Liked: 2 times
- Joined: Feb 18, 2021 9:42 am
- Full Name: Paul
- Contact:
Re: API Restoring 0365 Mailbox Folder to a Different O365 Mailbox
OK .. I found the log ..Sorry I was searching in the wrong place.
The account seems to not have right on the target Folder. But I don't know what are the recommandation for such configuration. IS there a blog post explaining how to setup it ?
The account seems to not have right on the target Folder. But I don't know what are the recommandation for such configuration. IS there a blog post explaining how to setup it ?
Code: Select all
03/06/2021 17:26:45 58 (6500) Action started: Get restoreDeviceCode (API version: V5)
03/06/2021 17:26:45 58 (6500) Action completed successfully: Get restoreDeviceCode
03/06/2021 17:27:14 58 (6500) Action: restoreTo
03/06/2021 17:27:14 58 (6500) Action started (action: restoreTo, data: folder, API version: V5)
03/06/2021 17:27:15 58 (6500) Token found with the following permissions: AllSites.FullControl, Directory.Read.All, EWS.AccessAsUser.All, Group.ReadWrite.All, offline_access, User.ReadWrite.All
03/06/2021 17:27:15 58 (6500) Token found with the following permissions: EWS.AccessAsUser.All, Group.ReadWrite.All, offline_access
03/06/2021 17:27:15 58 (6500) Validating if any of the required roles (Global Administrator, Exchange Administrator) is assigned to the current user: admin@xxxx.onmicrosoft.com...
03/06/2021 17:27:15 58 (6500) Required roles successfully validated
03/06/2021 17:27:15 58 (6500) Initializing Exchange Web Services...
03/06/2021 17:27:15 58 (6500) Connecting to Exchange Web Services (server: outlook.office365.com, account: <null>, ID: 48eb6d6e-9cd8-41d1-9379-3476fe6bfb0f)...
03/06/2021 17:27:15 58 (6500) Microsoft Exchange Web Services binding path: https://outlook.office365.com/EWS/Exchange.asmx
03/06/2021 17:27:15 58 (6500) Opening root folder using impersonation...
03/06/2021 17:27:15 58 (6500) Error: Failed to open mailbox: johndoe@xxxxx.onmicrosoft.com.
03/06/2021 17:27:15 58 (6500) Type: System.Exception
03/06/2021 17:27:15 58 (6500) Stack:
03/06/2021 17:27:15 58 (6500) à Veeam.Exchange.Restore.Restore.ExchangeConnection.OpenSpecialMailboxFolders(IEwsHolder ews, IExMailbox mailbox, IRestoreConfig config, String targetEmail)
à Veeam.Exchange.Restore.Restore.ExchangeConnection.OpenSpecialMailboxFoldersWithImpersonation(IEwsHolder ews, IExMailbox mailbox, IRestoreConfig config)
03/06/2021 17:27:15 58 (6500) Error: Failed to access mailbox.
03/06/2021 17:27:15 58 (6500) Type: Veeam.Ews.Internal.ExServerCodeException
03/06/2021 17:27:15 58 (6500) Stack:
03/06/2021 17:27:15 58 (6500) à Veeam.Ews.ExError.Throw(SoapException soap, String format, Object[] args)
à Veeam.Ews.ExError.Catch(Action action, String format, Object[] args)
à Veeam.Ews.ExError.Catch[T](Func`1 func, String format, Object[] args)
à Veeam.Ews.ExMailbox.GetWellKnownFolder(String mail, DistinguishedFolderIdNameType id, IReadOnlyDictionary`2 requestProps, CancellationToken cancel)
à Veeam.Ews.ExMailbox.GetMsgRootFolder(IReadOnlyDictionary`2 requestProps)
à Veeam.Exchange.Restore.Restore.Retry.ExMailboxRetry.GetMsgRootFolder(IReadOnlyDictionary`2 requestProps)
à Veeam.Exchange.Restore.Restore.ExMsgRootFolderProviderExtension.GetMsgRootFolder[T](IExMsgRootFolderProvider`1 mailbox, Boolean& canBeGroupMailbox)
à Veeam.Exchange.Restore.Restore.ExchangeConnection.GetMsgRootFolderWithImpersonation(IEwsHolder ews, IExMailbox mailbox, IRestoreConfig config)
à Veeam.Exchange.Restore.Restore.ExchangeConnection.OpenSpecialMailboxFolders(IEwsHolder ews, IExMailbox mailbox, IRestoreConfig config, String targetEmail)
03/06/2021 17:27:15 58 (6500) Error: The account does not have permission to impersonate the requested user.
03/06/2021 17:27:15 58 (6500) Type: System.Web.Services.Protocols.SoapException
03/06/2021 17:27:15 58 (6500) Stack:
03/06/2021 17:27:15 58 (6500) à System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
à System.Web.Services.Protocols.SoapHttpClientProtocol.EndInvoke(IAsyncResult asyncResult)
à EWServices.ExchangeServiceBinding.EndGetFolder(IAsyncResult asyncResult)
à Veeam.Ews.ExMailbox.GetFolder(GetFolderType gf, CancellationToken cancel)
à Veeam.Ews.ExMailbox.GetFolder(BaseFolderIdType id, IReadOnlyDictionary`2 requestProps, CancellationToken cancel)
à Veeam.Ews.ExError.<>c__DisplayClass7_0`1.<Catch>b__0()
à Veeam.Ews.ExError.Catch(Action action, String format, Object[] args)
03/06/2021 17:27:15 58 (6500) Opening root folder without impersonation...
03/06/2021 17:27:15 58 (6500) Connection 48eb6d6e-9cd8-41d1-9379-3476fe6bfb0f is closed
03/06/2021 17:27:15 58 (6500) Action failed (action: restoreTo, data: folder, error: Failed to open mailbox: johndoe@xxxxx.onmicrosoft.com.)
03/06/2021 17:27:15 58 (6500) Error: Failed to open mailbox: johndoe@xxxxx.onmicrosoft.com.
03/06/2021 17:27:15 58 (6500) Type: System.Exception
03/06/2021 17:27:15 58 (6500) Stack:
03/06/2021 17:27:15 58 (6500) à Veeam.Exchange.Restore.Restore.ExchangeConnection.OpenSpecialMailboxFolders(IEwsHolder ews, IExMailbox mailbox, IRestoreConfig config, String targetEmail)
à Veeam.Exchange.Restore.Restore.ExchangeConnection.OpenSpecialMailboxFoldersWithImpersonation(IEwsHolder ews, IExMailbox mailbox, IRestoreConfig config)
à Veeam.Exchange.Restore.Restore.ExchangeConnection.InitSpecialFolders(IEwsHolder ews, IRestoreConfig config)
à Veeam.Exchange.Restore.Restore.ExchangeConnection..ctor(EwsPool ewsPool, IRestoreConfig config)
à Veeam.Exchange.Restore.Restore.ExchangeConnectionFactory.CreateFromAuthenticator(IRestoreConfig restoreConfig, IEwsAuthenticator ewsAuthenticator, String defaultImpersonateAs)
à Veeam.Exchange.Restore.Restore.ExchangeConnectionFactory.LogDecorator(Func`1 factoryMethod)
à Veeam.Exchange.Restore.EWS.EwsConnectionFactory.CreateExchangeConnection(IRestoreConfig restoreConfig, IInternetProxyChecker proxyChecker, CancellationToken cancel)
à Veeam.Exchange.Restore.EWS.EWSConnectionFactoryExtension.CreateInternal(IEWSConnectionFactory exchangeConnectionFactory, ICertificateResolver certificateResolver, IRestoreConfig restoreConfig, IInternetProxyChecker proxyChecker, CancellationToken cancel)
à Veeam.Exchange.Restore.EWS.EWSConnectionFactoryExtension.CreateWithCertificateResolving(IEWSConnectionFactory connectionFactory, ICertificateResolver certificateResolver, IRestoreConfig restoreConfig, IInternetProxyChecker proxyChecker, CancellationToken cancel)
à Veeam.Exchange.REST.Restore.RestoreController.ExecuteFolderRestorer(Func`1 createConfig, Action`1 restore, IExtendedAudit audit)
à Veeam.Exchange.REST.Restore.Restorer.RestoreFolder(Guid restoreSessionId, Guid mailboxId, Byte[] folderId, RestoreOptions options, IExtendedAudit audit)
à Veeam.Exchange.REST.Clients.FolderClient.Restore(Guid restoreSessionId, Guid mailboxId, Byte[] folderId, RestoreOptions options)
à Veeam.Exchange.REST.RESTClients.RESTFolderClient.Restore(Guid restoreSessionId, Guid mailboxId, String folderId, RESTRestoreToOptions options)
à Veeam.Exchange.REST.Actions.FolderActionsExecutor.RestoreToDifferentLocation(RESTRestoreToDifferentLocation restoreParameters)
à Veeam.REST.ActionExecutionApi.ActionMapBuilder.<>c__DisplayClass9_0`1.<UntypedActionFromTyped>g__UntypedWrapper|0(JToken actionOptionsJson)
à Veeam.REST.ActionExecutionApi.ActionsMapExtension.<>c__DisplayClass0_0.<Execute>g__ActionToSafeExecuting|0()
à Veeam.REST.Actions.ActionExecutor.ExecuteActionImpl(Func`1 restAction, String actionName, IResponseBuilder responseBuilder, String dataName, IRequest uriSource, Func`1 checkData, HttpStatusCode successStatus)
à Veeam.REST.Actions.ActionExecutor.Execute(Func`1 restAction, String actionName, IResponseBuilder responseBuilder, String dataName, IRequest uriSource, Func`1 checkData, HttpStatusCode successStatus)
03/06/2021 17:27:15 58 (6500) Error: Failed to access mailbox.
03/06/2021 17:27:15 58 (6500) Type: Veeam.Ews.Internal.ExServerCodeException
03/06/2021 17:27:15 58 (6500) Stack:
03/06/2021 17:27:15 58 (6500) à Veeam.Ews.ExError.Throw(ExServerCodeException error, String format, Object[] args)
à Veeam.Ews.ExError.Catch(Action action, String format, Object[] args)
à Veeam.Ews.ExError.Catch[T](Func`1 func, String format, Object[] args)
à Veeam.Ews.ExMailbox.GetWellKnownFolder(String mail, DistinguishedFolderIdNameType id, IReadOnlyDictionary`2 requestProps, CancellationToken cancel)
à Veeam.Ews.ExMailbox.GetMsgRootFolder(IReadOnlyDictionary`2 requestProps)
à Veeam.Exchange.Restore.Restore.Retry.ExMailboxRetry.GetMsgRootFolder(IReadOnlyDictionary`2 requestProps)
à Veeam.Exchange.Restore.Restore.ExchangeConnection.OpenSpecialMailboxFolders(IEwsHolder ews, IExMailbox mailbox, IRestoreConfig config, String targetEmail)
03/06/2021 17:27:15 58 (6500) Error: The specified object was not found in the store., The process failed to get the correct properties.
03/06/2021 17:27:15 58 (6500) Type: Veeam.Ews.Internal.ExServerCodeException
03/06/2021 17:27:15 58 (6500) Stack:
03/06/2021 17:27:15 58 (6500) à Veeam.Ews.Internal.ResponseMessageTypeExtension.ThrowIfError(ResponseMessageType item)
à Veeam.Ews.Internal.BaseResponseMessageTypeExtension.GetItems[T](BaseResponseMessageType response)
à Veeam.Ews.ExMailbox.GetFolder(GetFolderType gf, CancellationToken cancel)
à Veeam.Ews.ExMailbox.GetFolder(BaseFolderIdType id, IReadOnlyDictionary`2 requestProps, CancellationToken cancel)
à Veeam.Ews.ExError.<>c__DisplayClass7_0`1.<Catch>b__0()
à Veeam.Ews.ExError.Catch(Action action, String format, Object[] args)
-
- Product Manager
- Posts: 5797
- Liked: 1215 times
- Joined: Jul 15, 2013 11:09 am
- Full Name: Niels Engelen
- Contact:
Re: API Restoring 0365 Mailbox Folder to a Different O365 Mailbox
The permissions are listed in our user guide. As you stated you are using MFA, can u verify everything is assigned as listed on the page within the application - section restore: Restore Using Device Code Flow?
Personal blog: https://foonet.be
GitHub: https://github.com/nielsengelen
GitHub: https://github.com/nielsengelen
-
- Influencer
- Posts: 24
- Liked: 2 times
- Joined: Feb 18, 2021 9:42 am
- Full Name: Paul
- Contact:
Re: API Restoring 0365 Mailbox Folder to a Different O365 Mailbox
Thank, you I think the problem is related to the user rights for the restore. According to documentation, the followinf roles are required for the user executing the restore :
Global Administrator or eventually ( Exchange Administrator, SharePoint Administrator, Teams Administrator )
And
ApplicationImpersonation
I'm not able to find the Role ApplicationImpersonation (I have the role in French witch is basically a mess... but basically none of the role I see are related to Application Impersonation. Google did not gave me interesting answers at all
Global Administrator or eventually ( Exchange Administrator, SharePoint Administrator, Teams Administrator )
And
ApplicationImpersonation
I'm not able to find the Role ApplicationImpersonation (I have the role in French witch is basically a mess... but basically none of the role I see are related to Application Impersonation. Google did not gave me interesting answers at all
-
- Product Manager
- Posts: 5797
- Liked: 1215 times
- Joined: Jul 15, 2013 11:09 am
- Full Name: Niels Engelen
- Contact:
Re: API Restoring 0365 Mailbox Folder to a Different O365 Mailbox
I believe u can follow this page: https://docs.microsoft.com/en-us/exchan ... ersonation
Or at least use the french version of the page to understand what is wrong. If u are stuck however u can always contact our support for assistance to clarify this issue. These forums are meant to help with technical questions/information but we can only assist to a certain extent
Or at least use the french version of the page to understand what is wrong. If u are stuck however u can always contact our support for assistance to clarify this issue. These forums are meant to help with technical questions/information but we can only assist to a certain extent
Personal blog: https://foonet.be
GitHub: https://github.com/nielsengelen
GitHub: https://github.com/nielsengelen
-
- Influencer
- Posts: 24
- Liked: 2 times
- Joined: Feb 18, 2021 9:42 am
- Full Name: Paul
- Contact:
Re: API Restoring 0365 Mailbox Folder to a Different O365 Mailbox
I finally find the solution on this page : https://support.cloudm.io/hc/en-us/arti ... Office-365 witch is more easy to implement that the version with Power Shell when you are on Mac
And after 3 trials the role has been successfully added. Now I've been able to restore the email in a different mailbox !
Thank you for the help.
And after 3 trials the role has been successfully added. Now I've been able to restore the email in a different mailbox !
Thank you for the help.
-
- Product Manager
- Posts: 5797
- Liked: 1215 times
- Joined: Jul 15, 2013 11:09 am
- Full Name: Niels Engelen
- Contact:
Re: API Restoring 0365 Mailbox Folder to a Different O365 Mailbox
Happy to hear! If u have additional questions, feel free to post/share them.
Personal blog: https://foonet.be
GitHub: https://github.com/nielsengelen
GitHub: https://github.com/nielsengelen
Who is online
Users browsing this forum: No registered users and 31 guests