Home > Exchange, Microsoft, Office 365 > Recover deleted emails on Exchange Online / Office 365

Recover deleted emails on Exchange Online / Office 365

I have separated this into multiple steps.

  1. Create a session to Exchange Online
  2. Find the users mailbox and locate the deleted emails
  3. Move the deleted emails to the users mailbox
  4. Permissions to do steps 2 and 3

 

  1. Create a session to Exchange Online
    • Enter User Credentials

      $Office365Cred = Get-Credential

    • Create the session

      $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ `
      -Credential $Office365Cred -Authentication Basic –AllowRedirection

    • Import the session

      Import-PSSession $Session

  2. Find the users mailbox and locate the deleted emails

    • Find the users mailbox from the list, skip if you know the user

      Get-Mailbox

    • Look for deleted emails

      Search-Mailbox “Charlotte Smith” -SearchQuery “to:’Martyn Dawson'” -TargetMailbox “Discovery Search Mailbox” -TargetFolder “Charlotte Smith Recovery” -LogLevel Full

      TIP!If the Search-Mailbox command is not available (you will get an error)  you are missing Discovery Management role. Go to Step 4

  3. Move the deleted emails to the users mailbox
    • Recover deleted emails

      Search-Mailbox “Discovery Search Mailbox” -SearchQuery “to:’Martyn Dawson'” -TargetMailbox “Charlotte Smith” -TargetFolder “Recovered Messages” -LogLevel Full -DeleteContent

      TIP! – If the command gives you the error below you are missing Mailbox Import Export role. Go to Step 4
      A parameter cannot be found that matches parameter name ‘DeleteContent’.
      + CategoryInfo          : InvalidArgument: (:) [Search-Mailbox], ParameterBindingException
      + FullyQualifiedErrorId : NamedParameterNotFound,Search-Mailbox
      + PSComputerName        : outlook.office365.com

  4. Permissions to do steps 2 and 3.
    • Use the command below to give your admin account the missing “Discovery Management” Role permissions

      Add-RoleGroupMember -Identity “Discovery Management” -Member email.address@mail.com

    • Check your admin accounts membership

      Get-RoleGroupMember -Identity “Discovery Management”

    • Use the command below to give your admin account the missing “Mailbox Import Export” Role permissions
      Create a new Role Group

      New-RoleGroup “Mailbox Import-Export Management” -Roles “Mailbox Import Export”

    • Give Permissions to your admin user

      Add-RoleGroupMember “Mailbox Import-Export Management” -Member email.address@mail.com

    • Check your admin accounts membership

      Get-RoleGroupMember -Identity “Mailbox Import-Export Management”

      TIP! – You need to restart the session after adding the permissions.

-Eric

 

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: