Försäljning

Test and enable programmatically

We have currently an issue with a customer running CRM 8.1 which have been migrated to Office 365 from an on-prem Exchange. This issue means that the Server side sync isn’t really working and only does one sync run when you click test & enable on the mailbox.

 To make a long story short, CRM 8.1 is said to support hybrid connections between CRM and Exchange where CRM is on prem and Exchange is online (O365). This seems however not be entirely true according to Microsoft who are saying that it isn’t ”fully supported”.

One thing that might cause the issue is that there are appointments being migrated from the on-prem exchange and I can’t really tell what is the integration key, they might have gotten a new ID in O365 and the old ID is still present in CRM.

The funny thing is that when you click test & enable on the mailbox in the GUI and also click the ”sync for this organization” checkbox, the mailbox is syncronized, once, and appointments are pushed to O365. Then it does nothing after this. We’ve been working with MS support during the summer to see if this can be solved but no luck yet. We even got an SQL script that should run test & enable which can be scheduled and it does test & enable but for some reason the syncing isn’t run.

There is no ”run test&enable” call in the API to the best of my knowledge, however I did find a post saying that if you set the fields orgmarkedasprimaryforexchangesync and testemailconfigurationscheduled to true on the mailbox with the api, the test&enable is run and the sync is also performed.

This is pretty much the code that is doing this.

Entity updMailbox = new Entity(mb.LogicalName, mb.Id);
updMailbox[”orgmarkedasprimaryforexchangesync”] = true;
updMailbox[”testemailconfigurationscheduled”] = true;
updMailbox[”postponemailboxprocessinguntil”] = DateTime.Now;

service.Update(updMailbox);

Hope this helps

Rickard Norström
Developer at CRM-Konsulterna

Kontakta oss med dina frågor!

Känner du dig osäker eller är du redo att komma igång? Kontakta oss så svarar vi på alla frågor eller föreslår ett uppstartsmöte där vi går igenom era behov.