Configure Exchange folder-level tracking rules

Applies To: CRM Online

Configure folder-level tracking rules to map a Microsoft Exchange inbox folder to a Microsoft Dynamics CRM record so that all the emails in the Exchange folder get automatically tracked against the mapped record in CRM. Folder-level tracking of emails will work only if:

  • The folder-level tracking feature is enabled for your CRM instance. You can enable folder-level tracking by using the web client or Microsoft Dynamics CRM untuk Outlook. Maklumat lanjut:TechNet: Configure folder-level tracking

  • The folder that you are tracking is under the Inbox folder in Exchange. Emails in the folders that are not under the Inbox folder won’t be tracked.

noteNota
Untuk organisasi Microsoft Dynamics CRM Online, ciri ini hanya tersedia jika organisasi anda telah dikemas kini kepada Dynamics CRM Online 2015 Update 1. Ciri ini tidak disediakan bagi Dynamics CRM (di premis).

Create and manage folder-level tracking rules

Use the MailboxTrackingFolder entity to programmatically configure and manage your folder-level tracking rules. To set up a tracking rule, use the following attributes.

 

Attribute Description

MailboxTrackingFolder.ExchangeFolderId

Specify the Exchange folder ID that you want to map. You can use the Exchange Web Services (EWS) to retrieve the ID of a folder under your Inbox folder. For more information, see MSDN: How to: Work with folders by using EWS in Exchange. This is a required attribute.

MailboxTrackingFolder.MailboxId

Specify the mailbox ID in CRM that you want to create the rule for. This is a required attribute.

MailboxTrackingFolder.RegardingObjectId

Set the regarding object in CRM that you want the specified Exchange folder to be mapped to. This is an optional attribute.

The following sample code shows how you can create a folder-level tracking rule.

// Create a folder-level tracking rule
MailboxTrackingFolder newTrackingFolder = new MailboxTrackingFolder();

// Set the required attributes
newTrackingFolder.ExchangeFolderId = "123456"; // Sample value. Retrieve this value using Exchange Web Services (EWS)
newTrackingFolder.MailboxId = new EntityReference(Mailbox.EntityLogicalName, _mailboxId);

// Set the optional attributes
newTrackingFolder.RegardingObjectId = new EntityReference(Account.EntityLogicalName, _accountId);
newTrackingFolder.RegardingObjectId.Name = _accountName;
newTrackingFolder.ExchangeFolderName = "Sample Exchange Folder";

// Execute the request to create the rule 
_folderTrackingId = _serviceProxy.Create(newTrackingFolder);
Console.WriteLine("Created folder-level tracking rule for '{0}'.\n", _mailboxName);

You can create a maximum of 25 folder-level tracking rules per mailbox. The folder ID of the Exchange folder can’t be validated at the time of creating the mapping using SDK. However, as soon as you create a mapping rule, and if the folder ID is invalid, it will show up in the UI in CRM to indicate that the mapping is invalid.

Any manual changes done to the regarding object in the tracked activity records, created in CRM as a result of the folder-level tracking rule, will be overridden the next time server-side synchronization occurs. For example, if you have set up a mapping between the Adventure Works folder and the Adventure Works account, all the emails in the Adventure WorksExchange folder will be tracked as activities in CRM with the regarding set to the Adventure Works account record. If you change the regarding of some activities to any other record, it will automatically be overridden the next time server-side synchronization occurs.

Retrieve folder-level tracking rules for a mailbox

You can retrieve all the folder-level tracking rules for a mailbox by using the RetrieveMailboxTrackingFoldersRequest message. Pass the mailbox ID for which you want to retrieve the rules in the RetrieveMailboxTrackingFoldersRequest.MailboxId property, and execute the message.

The following sample code shows how you can retrieve folder-level tracking rules for a mailbox.

// Retrieve the folder mapping rules for a mailbox
RetrieveMailboxTrackingFoldersRequest req = new RetrieveMailboxTrackingFoldersRequest
{
    MailboxId = _mailboxId.ToString()
};

RetrieveMailboxTrackingFoldersResponse resp = (RetrieveMailboxTrackingFoldersResponse_serviceProxy.Execute(req);
Console.WriteLine("Retrieved folder-level tracking rules for {0}:", _mailboxName);
int n = 1;
foreach (var folderMapping in resp.MailboxTrackingFolderMappings)
{
    Console.WriteLine("\tRule {0}: '{1}' is mapped to '{2}'.", 
        n, folderMapping.ExchangeFolderName, folderMapping.RegardingObjectName);
    n++;
}

Lihat Juga

Microsoft Dynamics CRM 2015 and Microsoft Dynamics CRM Online
Send comments about this topic to Microsoft.
© 2015 Microsoft. All rights reserved.
Tunjukkan: