Disclaimer: this workaround is categorised as unsupported by Microsoft as described in the following Best Practice article: https://technet.microsoft.com/en-gb/library/dn887218.aspx
Recently I just configured a Dynamics CRM Online to Exchange Online that has custom domain. It was a straight forward process for environment that is using “onmicrosoft.com” domain as their username and email address. However, in most of real cases, it should not use onmicrosoft.com domain for production environment, as it does not reflect the branding and ownership of the company. Most of the customers will use their own domain, e.g: email@example.com.
For this implementation I have followed through the regular guide on approving the mailbox as described in: https://technet.microsoft.com/en-us/library/dn832109.aspx. However as the email address is using the customer’s domain name, I always encounter an error during the “Test and Enable” the mailbox: The mailbox location could not be determined while sending/receiving the email message <Message Subject>. The mailbox <Mailbox Name> has been disabled for sending/receiving email and the owner of the associated email server profile <Email Server Profile name> has been notified.
That error message is listed up on the troubleshooting guide on: https://technet.microsoft.com/en-us/library/dn850386.aspx. The resolution for this error is: “You will see this alert if your email server profile (Settings > Email Configuration > Email Server Profiles) is configured to use the Auto Discover Server Location option but auto discover cannot detect the location of your mailbox. If this issue occurs, check with your Exchange administrator to verify your network is configured for auto discover. You can update the email server profile and choose No for Auto Discover Server Location. Then provide the Exchange web services URL for your Exchange deployment.”
Now, for Dynamics CRM Online, it seems Microsoft have applied a different script/css to hide the Auto Discover Server Location settings. As a workaround I need to do some HTML hack to bring back the elements to be editable.
Now it’s the step by step guide:
- Open the Exchange Online email server profile from Settings > Email Configuration > Email Server Profiles.
- Using browser’s developer tool (in my example, I’m using IE, but it’s up to you to use your favorite browser). Find the auto discover element: with id useautodiscover_c and useautodiscover_d, remove the style tag that hide the element:
- Now the Auto Discover Option should be visible, but they are in disabled state. So, we need to remove the disabled tag on the following element: div with id: useautodiscover and and input radio button with name: rad_useautodiscover.
- Now you should have the Auto Discover Server Location tag to be editable, set it to No.
- Then the next part is to make Incoming and Outgoing Server location to be editable and set the exchange online web service address: https://outlook.office365.com/EWS/Exchange.asmx. To make the fields editable, find the following elements: input with id: incomingserverlocation and outgoingserverlocation.
- Now you should have the fields editable:
- Once you’ve specified the above configuration, save and close the Email Server Profile for Exchange Online. Then go back to the mailbox and run again the “Test and Enable” process. You should have the server side sync worked.