Mailboxes in Exchange Online can’t be set as hidden in the address book, while having DirSync / ADConnect enabled to sync your on premises AD objects. In fact, when trying to do so in the Exchange Online web interface, the following error will popup:
The operation on mailbox “” failed because it’s out of the current user’s write scope. The action ‘Set-Mailbox’, ‘HiddenFromAddressListsEnabled’, can’t be performed on the object ” because the object is being synchronized from your on-premises organization. This action should be performed on the object in your on-premises organization.
To (un)hide the mailbox from your address book, you need to modify the msExchHideFromAddressLists attribute on the related Active Directory object. To fulfill, follow these steps
- Logon to a server on which Exchange Management Console is installed
- Open Active Directory Users and Computers (dsa.msc)
- Click View–> Advanced Features This enables the tab Attribute Editor
- Navigate to the User / AD Account you want to (un)hide in your address book. Double Click to open its properties
- Go to tab Attribute Editor
- Scroll down to msExchHideFromAddressLists
- Double click and choose True or False. Not Set will be the default which is normally False
- Click OK twice. Wait or force a sync with Azure to reflect your changes.