Thursday, 8 September 2016

How to add a custom field or attribute in user’s mailbox in Office365 server?

Or, Adding additional custom fields in email mailbox’s properties hosted on Office365 server.
Or, Office365 mailbox additional custom field in mailbox properties.
Or, Exporting custom attribute of all User mailboxes in Office365.
Or, Export all user’s mailbox list of Office365 server with custom attributes.

If you are an Office365 online exchange server administrator, you may have faced this query or may face in future. This situation typically arises when you have your AD domain completely separate and your email Office365 server domain is not integrated with your AD domain.
For example: Your AD domain may be and your Email domain of Office365 server is

Your management team wants you to put Employee ID of every user for reference purpose as a unique identifier of AD accounts as well as for email accounts so that it can be easily tracked which user ID or email ID belongs to which users when performing reconciliation of AD or Email accounts to get them in sync (Ideally you should be having equal number of AD and Email accounts always except Service accounts and DLs).

There may be situation where you may have multiple users with same Display Name (login ID can be different), in this case it will be tough for you to identify who is the actual user you are targeting for any specific purpose. Now if you have had the employee ID written for all users somewhere in AD account’s and email account’s properties, it could have been easy to identify the actual users and map them accordingly.

Options available in AD and Office365(may be considered if suited best for your need):

AD (Active Directory): You have Description field where you can specify the Employee ID if all other relevant AD fields you are already using for some purpose.

Now when you want to export the AD users accounts with description fields and other required fields, you can read my another article “Exporting AD Users”.

Office365: You can go to mailbox properties and specify the custom attribute and values with Employee ID.

Now to export the all Email mailboxes with defined custom attributes in mailbox’s properties, you may use/run below command on Office365 PowerShell:
Get-Mailbox -Filter '(RecipientTypeDetails -eq "UserMailbox")' | Select RecipientTypeDetails,Name,Alias,CustomAttribute1 | Export-Csv -Path D:\CAT.csv

To know how to connect to Office365 PowerShell, please see my another article:

You can refer below screenshot for more details in graphical view.

Now you have the CAT.CSV report with all mailboxes and custom attributes in your D:\ drive. Yes, off-course the Custom attributes will be having the employee IDs that you had already entered there in the user’s mailbox properties.

Cheers, Please write me back if you have any query or feedback..


  1. Hi, thanks for this article. Can you help advise what filters to use to allow the country, job title to be included in the export from office 365?

    1. You can navigate through the attributes available under the user's properties. Those all attributes can be used to export in the CSV or excel report.