Automatically Track All Incoming and Outgoing Email Messages in Dynamics 365 without opening Outlook and across any device :: Pure Exchange and Dynamics 365 Server Side Synchronisation

Sometimes organisations want to track all incoming and outgoing emails for a number of users at Server Side without having the user to do anything manually and across all devices. The requirement here is to save the user time from clicking on “Track” emails when they are sending them or having to manually move incoming emails into a tracked folder to be tracked. They also want this to work on every email sent from any device and every email received even if Outlook is not open. This what I call “pure Server Side Synchronisation”.

As the name gives it away, Dynamics 365 Server Side Synchronisation and Dynamics 365 App for Outlook can help us achieve this requirement with some help from Exchange Mail Flow Rules that uses the transportation layer directly. Just to re-iterate, we are here using Dynamics 365 App for Outlook (not the client). If you are not sure what is the difference between Dynamics 365 App for Outlook and the Dynamics 365 for Outlook (also known as the Outlook Client), you can refer to this comparison: https://docs.microsoft.com/en-us/dynamics365/customer-engagement/outlook-app/v8/deploy-dynamics-365-app-for-outlook

 

My approach is using Server Side Synchronisation between Dynamics 365 Online Cloud and Exchange Online but the same approach may work with other setups to achieve the same requirement: Track all incoming and outgoing emails automatically from any device. I’m also applying all of this on 1 single “test user” but you can apply this on as many users as you want. My test user is called “sales test”.

In this post, I will not take you in detail through the process of setting up server side synchronisation. You can refer to the official Microsoft Documentation and this comprehensive step by step guide to set server side sync up first before you continue: https://docs.microsoft.com/en-us/dynamics365/customer-engagement/admin/connect-exchange-online

Once you do all the steps in the above guide and you have fully setup server side synchronisation, you will then need to make sure that your test user has setup folder level tracking in their Outlook (Office Outlook or Web rules are fine). To do this, you can follow the step by step guide here: https://docs.microsoft.com/en-us/dynamics365/customer-engagement/admin/track-outlook-email-by-moving-it-tracked-exchange-folder

In summary, before you automate the tracking of all email messages both incoming and outgoing, you must have Server side synchronisation setup, push (i.e. remotely install) Dynamics 365 App for Outlook to your user(s) and you must also setup 1 folder for Dynamics 365 tracking in your user Outlook. This can be a folder under their Inbox which is then configured in Dynamics 365 for tracking (as per the above guide). For your convenience, I have summarised here the steps to setup Folder tracking (refer to the above guide for detailed guidance):

To Set up a tracked folder

  1. In the User “Personalisation Options” or “Personal Option”, click the Email tab, and then under Select the email messages to track in Dynamics 365, select “All Messages”. 
  2. Then Click on Configure Folder tracking Rules. In the Folder-Level Tracking dialog box, under Exchange Folder, click + New Folder Mapping, click the down arrow in the box that appears, and then select the folder you want to track.Where “CRM Tracking” is a folder under Inbox in Outlook, as shown in the following screenshot:

With that, you have Server Side Synchronisation and Folder Level tracking setup for 1 single folder called “CRM Tracking”. Any email message inside this folder will be tracked. Next, we will setup the automation of the tracking of all incoming and outgoing emails, which is the purpose of this post.

To automate the tracking of all incoming email messages, you will need to create an Outlook email rule to copy all email messages received in the user inbox to the “CRM Tracking” folder. Please remember all your outlook email rules must be server side for this to work. If the rule has “Client-only” next to it, emails are moved between folders client side only and not server side which means tracking won’t work.

So, the first rule to create on Outlook is a rule to copy all messages received to the tracked folder. This rule is simple and will look something like this:

 

then

This rule will copy every received message to the “CRM Tracking” folder. But how about sent messages (outgoing email)? Here is the complex part – so follow me to the letter on this one:

If you were to create a new rule via the “Apply Rule on messages I send” that copies every email sent by the user to the same folder “CRM Tracking”, the new rule will always be “Client-only”. This means sent emails are copied on client side only to the tracked folder but not server side – so nothing will appear in Dynamics 365 (remember this is server side tracking not client side).

Also, I have been told that you can create another rule that starts with “Move messages from someone to a folder”, select the same user of this inbox as that “someone” and the “CRM Tracking” folder as the target and this could copy sent emails to the tracked folder server side. I have tried this but it didn’t work for me – emails were not tracked. If you tried it and it worked for you, then please let me know what you did.

On the other hand, if the user was to cc themselves in every email message they send, they will receive a copy in their Inbox, which will then be moved to the tracked folder – hence, this message will be tracked in Dynamics 365. However, the email message will be tracked as “Received” not “Sent”. This also means the user will have a copy of every message they send in their inbox and while they can automate the “Cc” of themselves, it looks odd to the receiver of the email to see the user cc’ing themselves. Hence, this is not a good solution either – it’s a possible solution but not so elegant.

So here comes the approach that is complex, elegant and guaranteed to work – I have tried it several times by now and it always works.

Thanks to an excellent tip from my friend and fellow MVP, George Doubinski, I used Exchange Mail Flow to Bcc every sent message our test user sends. Here is how to do it:

 

  1. Go to the Exchange Online Admin Centre (also known as Exchange Control Panel). You can jump directly to it via this link: https://outlook.office365.com/ecp (you need to be Office 365 Admin)
  2. Click on “Mail Flow” from the left hand menu:
  3. Under “Mail Flow” è Rules, click on “+” to create a new rule that does the following:
    1. Bcc every email message sent by this user to “itself”
    2. Set a message header to every sent message with value “crmtrack” or “techlabslondontrack” (or any message header value of your choice)

Your rule will look something like this:

Once you create your rule, you will need to go back to Outlook rules and firstly, update the first rule we created that copies all messages from inbox to the tracked folder, and add an exception to avoid messages that has “crmtrack” in the header. This way, all sent messages that have been Bcc’ed and arrive in the user inbox, will not be copied to the tracked folder. This rule now looks like this:

Instead, we will create a 2nd Outlook email rule to move (move not copy) all messages that arrive in the user inbox and which has the header “crmtrack” to the tracked folder. This rule will look like this:

 

So to summarise, we ended up creating 3 rules in total:

 

  1. Outlook Rule to copy all email messages that arrive in the user inbox to the tracked crm folder except if the message has “crmtrack” in the message header.
  2. Exchange Online Mail Flow rule that works at the transportation layer to “Bcc” every single email sent from the user to themselves and adds the “crmtrack” header value to the sent email message header
  3. Outlook Rule to move all email messages that arrive in the user inbox that has the “crmtrack” header to the tracked folder.

The reason we use copy for all incoming emails is to allow the user to continue to use their inbox as normal keeping all received emails in inbox. The reason we use move (not copy) for sent emails that arrive as Bcc in the user inbox, is to make sure that all sent emails do not stay in the user inbox. They will continue to exist in the sent folder and a copy will be sent to the tracked folder.

 

The result of all of the above complicated approach is that ALL incoming emails are tracked in Dynamics 365 automatically as “Received” emails and ALL outgoing emails are tracked in Dynamics 365 CRM automatically as “Sent” emails. As this approach is using Exchange Online transportation layer, this is a pure Server Side Synchronisation of Email messages with Dynamics 365 which means it will work with “ALL Emails” sent from ANY Device and any app as the synchronisation happens at the server side and not on the client side. So if you sent an email from the Outlook for the Web (Web Mail), sent it from an Android device email client, iPhone Mail app, Outlook app on iPhone, Office Outlook or any other medium, all emails sent and received are tracked in Dynamics 365.

This is how it looks like in Dynamics 365: Tracked emails sent from any device and emails received while Outlook is closed:

Thanks for reading thusfar! I have spent a lot of time researching and writing this up with the aim to help anyone who is trying to achieve full Dynamics 365 incoming and outgoing email tracking on server side fully regardless of which device or client the email was sent from.

I will be posting another blog post about the same subject soon but this time I will achieve the same result using 100% Exchange Mail FLow Rules via the Transportation Layer.

I hope this helps!