Microsoft CRM Programming Secrets – Tips For Developers

This article is for advanced Microsoft CRM SDK C# developers. It describes the technique of direct SQL programming, when SDK doesn’t have the functionality to do the job.

Introduction. Looks like Microsoft CRM becomes more and more popular, partly because of Microsoft muscles behind it. Now it is targeted to the whole spectrum of horizontal and vertical market clientele. It is tightly integrated with other Microsoft Business Solutions products such as Microsoft Great Plains, Solomon, Navision .
Here we describe the technique of creating closed activity-email using MS CRM SDK and direct SQL programming.

Imaging something like this. You need to handle incoming email before it is committed to MS Exchange database. You need to analyze if incoming email doesn’t have GUID in its Subject – then you still need to lookup MS CRM in case if one of the accounts, contacts or leads has email address that matches with sender email address – then you need to create closed activity-email in MS CRM, attached to the object and placed into general queue.

How to create MS Exchange handler is outside of the scope, please see this article:
http://www.albaspectrum.com/Customizations_Whitepapers/Dexterity_SQL_VBA_Crystal/ExchangeHandlerExample.htm

Now the code below is classical MS CRM SDK and it will create activity email:

public Guid CreateEmailActivity

else if

else if

strPartiesXml += “ “+ objectId.ToString + ““;

strPartiesXml += “ “;

strPartiesXml += Microsoft.Crm.Platform.Types.ACTIVITY_PARTY_TYPE.ACTIVITY_PARTY_SENDER.ToString;

strPartiesXml += ““;

strPartiesXml += ““;

strPartiesXml += ““;

log.Debug;

// Create the e-mail object

Guid emailId = new Guid);

return emailId;

catch
catch
return new Guid;

Now I would like to share the trick with you – there is no method to make this activity closed in MS CRM SDK 1.2 . Obviously Microsoft doesn’t support if you do direct SQL programming bypassing SDK. However I would say this is not direct objects creation – this is rather flags correction. So here is what we have – this procedure will do the job and make activity closed:

public void UpdateActivityCodes

catch

Happy customizing! if you want us to do the job – give us a call 1-866-528-0577! “>help@albaspectrum.com

About the Author

Andrew Karasev has written 2 stories on this site.

One Comment on “Microsoft CRM Programming Secrets – Tips For Developers”

  • AndrewBoldman wrote on 4 June, 2009, 8:50

    I really liked this post. Can I copy it to my site? Thank you in advance.

Write a Comment

Gravatars are small images that can show your personality. You can get your gravatar for free today!

You must be logged in to post a comment.

Copyright © 2010 TechnoForum. All rights reserved.