Microsoft does not provide any dedicated tool to export PST from Office 365 online (like Scanpst for PST Repair). Even, New-MailboxExportRequest cmdlet cannot be utilized as the command demands a UNC path. With Office 365, mail server resides in Microsoft’s data centre and to fulfil the purpose, the UNC path requires a point to the server.
Microsoft doesn’t allow the SMB traffic via firewalls. There are several workarounds that we can execute to export 365 mailboxes to PST file. Here, ways such as using PowerShell as an administrator or Office 365 PST export tool have been suggested. However, the manual method that utilizes PowerShell is quite complex and requires technical expertise. The complexity is due to the following:
- Exporting mailbox after holding necessary rights
- Running search for exporting mailbox contents that needs to be archived into a folder in mailbox that you possess right to access
- Permitting full access to the mailbox that you need to export to the mailbox for which you hold access rights and can open with MS Outlook
Let’s discuss the entire procedure of exporting Office 365 mailbox to PST using PowerShell as an administrator. Here, it is done with the help of an example where hypothetical mailbox that needs to be exported is firstname.lastname@example.org. The new account that is created in Outlook for exporting the mailbox is email@example.com. The account with administrator rights to Office 365 is firstname.lastname@example.org. Following is the procedure to execute the export procedure.
#1: Establish Connection to MS Exchange Server using PowerShell
- In order to initiate procedure to export PST from Office 365 online, run the following command in PowerShell:
“$UserCredential = Get-Credential”
Enter Office 365 account credentials including ‘Username’ and ‘Password’ in Windows PowerShell Credential Request dialog box. Enter the email@example.com credentials in the pop-up window.
- Next, run the following command:
“$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic –AllowRedirection”
-where $ocred is used as UserCredential
- Run the following command
- While executing the above-mentioned cmdlets and the entire procedure to export Office 365 mailboxes to PST, make sure that you key in the correct username and password in Step 1; else, you will not be allowed to proceed further.
- You can attempt only three limited open remote PowerShell connections to the Exchange online organization for preventing denial-of-access (DoS) attacks.
- Make sure that the account that is being used for connecting to Exchange is enabled for remote PowerShell.
- It is vital that ‘TCP port 80’ traffic must be open between Office 365 and local machine. With limited Internet access policy, it is something that needs to be considered.
#2: Grant Access Right to Mailbox for Export using PowerShell
The following example will grant firstname.lastname@example.org full access to email@example.com mailbox:
“Add-MailboxPermission – User firstname.lastname@example.org -Identity email@example.com -AccessRights FullAccess -InheritanceType All”
#3: Open Outlook for New Account
You need to open Outlook as firstname.lastname@example.org and ensure that the email@example.com mailbox is displayed in the mailbox list in the left pane. Permissions might take a few seconds and even minutes to take effect.
#4: Check Configuration Settings
Outlook must be ready to configure for downloading all the mails for a limited time. Click on the File menu and on the Info page, click on the Account Settings. From the menu, select Account Settings and select your account and then click on the Change button. Make sure that Use Cached Exchange Mode is enabled i.e. it is checked as well as Mail to keep offline is set to All.
Note: Relaunch MS Outlook to update the application with recent changes being made and proceed further to export office 365 mailbox to PST using PowerShell.
#5: Export Mailbox to PST using Import/Export Wizard
Follow the steps below:
- Use Import/Export wizard to export firstname.lastname@example.org to the PST file. Click on the File menu, click on Open & Export and then select Import/ Export option
- Select Export to a file from the given list of options and tap on Next
- Next, select ‘Outlook Data file (.pst)’ from the list and click on Next
- Select email@example.com from the list of mailbox folders and click Next. Make sure that ‘Include Subfolders’ checkbox is checked.
- Specify a new name for the file and storage location where the PST file needs to be stored i.e., c:\tmp\outlook-archive- hr-managementdtls -20160209.pst.
- Under Options section, select either ‘Do not export duplicate items’ or ‘Replace duplicates with items exported’. Next, click Finish to complete export procedure.
- When Outlook prompts to specify password for PST file, provide appropriate password if required or leave the field blank if the applied policy allows you to do it and click on OK
- Outlook will remain inoperative during the execution of the export process. Wait until Outlook stops displaying the progress of export procedure and grant control
#6: Verify if Export Procedure is Successfully Accomplished
To verify if the export process is completely done, check the mailbox size on Server and compare it to the exported PST size. Follow the steps below:
- Right click on the mailbox in the right pane and then select ‘Data file properties’ from options
- Next, click on the Folder Size button under the General tab
- In the Folder Size window, click on Server Data tab and notify the value mentioned in Total Size
- Next, check the file properties of PST file being exported. Make sure that the size of this file is comparable to the Total Size value as shown by MS Outlook. The PST file can appear up to 10% larger in size.
#7: When Export Completes
When export procedure is completed, you need to remove the permissions that are assigned previously, in the beginning, using PowerShell. This can be done using the following syntax:
“Remove-MailboxPermission -User firstname.lastname@example.org -Identity email@example.com -AccessRights FullAccess”
#8: Close PowerShell Session
At last, the PowerShell session needs to close down after the permissions are removed. The following command needs to be executed:
Another Comprehensive Way to Export PST File from Office365
As the above-described method is quite complicated ultimately confusing the database administrator, it is better to use Stellar Office365 Extractor for the purpose. It is known for extracting complete mailbox data from Office 365 account in one go without interruption. Unlike the manual method, it exports PST file from Office 365 successfully without the administrator having to put much effort. It does the tasks in a simplified manner owing to its Do-it-yourself make.