Creatio development guide
PDF
This documentation is valid for Creatio version 7.10.0. We recommend using the newest version of Creatio documentation.

Synchronizing email with MS Exchange

Glossary Item Box

General information

Synchronization with various services of MS Exchange via EWS protocol (Exchange Web Services) is supported by the Sync Engine synchronization mechanism. This article describes the synchronization of email in bpm'online with MS Exchange. Email in bpm'online is synchronized only from MS Exchange. Since emails can no longer be modified after they have been sent, only the emails that have not been synchronized previously are synchronized. The main difference between the email synchronization mechanism and integration is the email search engine in bpm'online. Since the same email can be synchronized on behalf of any of the recipients or even via IMAP protocol, metadata synchronization can not be used for searching for previously synchronized emails. Use subject, send date and message to search for emails . All markups and spaces are removed from the message. To speed up the search, use the md5 hash that is stored in the MailHash column of the Activity object.

The second difference of this synchronization is that attachments are synchronized by a separate process, after all emails are processed. This is done in order to make the attachment download time not affect the email save time.

Integration classes

As described in the "Bpm'online synchronization with external storages" article, to implement integration using this mechanism, a class is required that implements the logic of working with external storage (RemoteProvider heir) and a class that implements the IRemoteItem interface, which is an instance of the synchronization element (in our case — email MS Exchange).

Fig. 1. RemoreProvider hierarchy schema

The ExchangeEmailSyncProvider class is the service provider for the exchange external storage. This class implements the logic of selecting data from MS Exchange.

The ExchangeEmailMessage class implements the IRemoteItem interface, in which the logic of filling in data in bpm'online objects is implemented.

The ExchangeUtility class contains methods for the EWS API library and the methods used to download email attachments.

The ExchangeEmailMessageUtility class contains methods for converting the lookup values of the email fields.

Fig. 2. RemoteItem hierarchy schema

Synchronized data

The correspondence of bpm'online objects to the EmailMessage class fields is shown on table 1.

Table 1. The correspondence of bpm'online objects to the EmailMessage class fields

Bpm'online object Object field EmailMessage corresponding field
Activity Title Subject
Body Body.Text
Sender Sender
Recepient ToRecepients
CopyRecepient CcRecepients
BlindCopyRecepient BccRecepients
SendDate DateTimeSpent
Priority Importance
DueDate, StartDate DateTimeReceived
ActivityFile Name Name
Data Content
Size

Content.Length

Logic of filling in email participants

For an email to be displayed correctly only for users who have synchronized it, the following mechanism of filling in the [Activity participants] detail has been implemented. Conventionally, this logic can be divided into two parts:

  1. Adding participants to a new email.
  2. Updating the list of participants when an email changes (including re-synchronization).

Adding participants to a new email

The main value that affects who becomes the participants of an email is the [Communication] contact detail. If a contact has an email address in the [Communication] detail, and this email is listed in one of the email address fields ([From], [To], [CС], [BCC]), the contact can be added to the participants. Additionally, a check is made whether there is a system user for this contact who is not a portal user. A user is added to the participants only after they have synchronized their email.

Updating the list of participants

For a user to become a participant after the synchronization of an existing email, the list of participants is updated - all participants who are not bpm'online users are removed from the detail, and the algorithm of filling in detail for a new email runs. Thus, the users who have previously synchronized the email remain as participants, a new user is added, and the contact list is updated.

Logic of selecting data for synchronization

When selecting emails for synchronization with MS Exchange, use the following filter set: select emails that have been modified since the last synchronization and are not drafts. There is a limit for synchronization folders: "Deleted" and "Conflicting elements" folders do not participate in synchronization. When selecting emails the synchronization metadata is not taken into account. Always "save changes in bpm'online". When processing each email, the system first checks for emails in bpm'online. If an email already exists in bpm'online, the participants are updated. If not, a new email is created. At the end of the synchronization, the system adds a task to synchronize attachments.

© bpm'online 2002-2017.

Did you find this information useful?

How can we improve it?