One of our customers recently had a user leave the company, but wanted to retain their mailbox data in the form of a Shared Mailbox (so that it did not consume an Office 365 licence).
The issue with Office 365 is that if you remove a licence from a user, it automatically deletes the associated mailbox!
To work around this, the user's mailbox data was exported to PST, a new Shared Mailbox created, and then the PST data was re-imported back into said Shared Mailbox.
Once done, the user's SMTP address was changed, and the Shared Mailbox SMTP address was changed to that of the email address of the user, meaning all future new email would continue to flow into the Shared Mailbox.
The problem with doing it this way is that although the Shared Mailbox works fine for external users, the old user object now can't be deleted within the portal as the following error is received
Not all selected users were deleted
Some users can’t be deleted because they are managed with a service other than Office 365. You need to remove all licenses associated with the user and then delete the user.
Unfortunately the only way to delete the user is to connect to Office 365 via PowerShell by running the following commands in turn:-
- Set-ExecutionPolicy remotesigned
- $LiveCred = Get-Credential
- $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
- Remove-MsolUser -UserPrincipalName <account id>
- Remove-MsolUser -UserPrincipalName <account id> -RemoveFromRecycleBin
Going forward, converting the mailbox from user to shared with the following commands is probably the best way to achieve the desired result (after you have taken a PST backup first of course):-
- Get-Mailbox -identity email@example.com | set-mailbox -type “Shared”
- Set-Mailbox firstname.lastname@example.org -ProhibitSendReceiveQuota 10GB -ProhibitSendQuota 9.75GB -IssueWarningQuota 9.5GB
- Add-MailboxPermission email@example.com-User "OtherUser" -AccessRights FullAccess
$VARIABLE = (Get-MSOLUser -UserPrincipalName firstname.lastname@example.org).Licenses.AccountSkuId
Set-MsolUserLicense -UserPrincipalName email@example.com -RemoveLicenses $VARIABLE
NB - Shared mailbox sizes increased from 5GB to 10GB last year.
Hope this helps.