Restore a deleted mailbox
When a user loses their Exchange Online license, their mailbox is retained for 30 days. During that 30-day period, the mailbox can be recovered by re-assigning the license to the user. However, this is only possible for 30 days.
In the Admin Portal:
Go to Users > Active users. Select the user in question.
Select Edit to modify product licenses.
Assign the Exchange Online license to the user, and then select Save.
Shared mailboxes are also recoverable within 30 days. You can find shared mailboxes under Users > Deleted users. Shared mailboxes do not require an Exchange Online license.