Cannot restore the SoftDeleted mailbox in O365

Jack Chuong 361 Reputation points
2023-02-21T08:37:44.22+00:00

Hi all,

I have a softdeleted mailbox guid

$oldguid=(Get-Mailbox -SoftDeletedMailbox -Identity test.migration@mydomaincom.mail.onmicrosoft.com).Guid
echo $oldguid
Guid
----
85dc9b16-0100-48f4-81f5-546ac0e71cba

I have new mailbox account guid

2c765720-409f-4745-b11c-8602bbef5e49



When I try to reconnect softdeleted mailbox to new account

New-MailboxRestoreRequest -SourceMailbox $oldguid -TargetMailbox $newguid -AllowLegacyDNMismatch
Cannot process argument transformation on parameter 'SourceMailbox'. Cannot convert the "85dc9b16-0100-48f4-81f5-546ac0e71cba" value of type "System.Guid" to type
"Microsoft.Exchange.Configuration.Tasks.MailboxLocationIdParameter".
+ CategoryInfo          : InvalidData: (:) [New-MailboxRestoreRequest], ParameterBindin...mationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,New-MailboxRestoreRequest
+ PSComputerName        : outlook.office365.com

This command works fine

New-MailboxRestoreRequest -SourceMailbox "85dc9b16-0100-48f4-81f5-546ac0e71cba" -TargetMailbox "2c765720-409f-4745-b11c-8602bbef5e49" -AllowLegacyDNMismatch

How can I get mailbox guid and convert its value to string ?

Please give me some advice , thank you very much.


Microsoft Exchange Online
Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,388 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,330 questions
0 comments No comments
{count} votes

Accepted answer
  1. Andreas Baumgarten 104K Reputation points MVP
    2023-02-21T17:26:31.78+00:00

    Hi @Jack Chuong ,

    it looks like the variable $oldguid is from type Guid.

    You can give this a try to write the value in a string variable instead of a Guid variable:

    [string]$oldguid=(Get-Mailbox -SoftDeletedMailbox -Identity test.migration@mydomaincom.mail.onmicrosoft.com).Guid
    echo $oldguid
    

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards Andreas Baumgarten

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Limitless Technology 44,126 Reputation points
    2023-02-21T16:46:43.8233333+00:00

    Hi. Thank you for your question and reaching out. I’d be more than happy to help you with your query

    It is possible to restore a SoftDeleted mailbox in Office 365, but it is not always straightforward. The process involves connecting to the Office 365 Exchange Online PowerShell and then using the Get-Mailbox cmdlet to list any SoftDeleted mailboxes. Once you have identified the mailbox you want to restore, you can use the Restore-Mailbox cmdlet to restore the mailbox. However, it is important to note that for some Office 365 plans, you may need to create an inactive mailbox before you can restore the SoftDeleted mailbox, in which case you would need to use the New-InactiveMailbox cmdlet.

    If the reply was helpful, please don’t forget to upvote or accept as answer, thank you.

    0 comments No comments