3
votes

Our client is using Microsoft CRM 2011 outlook client and they have a unique business need. They want to make the "Set Regarding" mandatory for all of their employees using outlook to send emails (Weird huh?). If a user while sending the email forget to set regarding, outlook should display a notification message and shouldn't let the user send the email.

I have not been able to find any out of the box feature for this so I decided to write an outlook addin. Is there a way to know in outlook addin ItemSend event that the mail item has the value set for regarding field? I can get the subject of the email including CRM:xxxxx but since the email is not yet created in CRM I don't know how to pull the regarding data.

2

2 Answers

3
votes

The information about the tracking are stored in the MAPI-properties of the mail. See the attached screenshot. They should be accessible in the ItemSend event.

You could get this information like this (from @Ahmeds comment)

dynamic regardingId = mailItem.PropertyAccessor.GetProperty("schemas.microsoft.com/mapi/string/‌​;{00020329-0000-0000-C000-000000000046}/crmRegardingId/0x0000001F");

enter image description here

0
votes

I used following code in VS2012 and outlook 2010 to get the regarding GUID.

dynamic id = mailItem.UserProperties["crmRegardingId"]; 
if (id != null) Console.Write(id.Value); 
else Console.Write("Error");