Microsoft CRM Programming Secrets - Tips For Developers


Visitors: 1,548
 1 vote

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 (the last two in progress). 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 (GUID will allow MS CRM Exchange Connector to move email to Microsoft CRM and attach it to the Contact, Account or Lead) - 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:

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

public Guid CreateEmailActivity(Guid userId, int objectType, Guid objectId, string mailFrom, CRMUser crmUser, string subject, string body) { try {

log. Debug("Prepare for Mail Activity Creating");

// BizUser proxy object

Microsoft. Crm. Platform. Proxy. BizUser bizUser = new Microsoft. Crm. Platform. Proxy. BizUser();

ICredentials credentials = new NetworkCredential(sysUserId, sysPassword, sysDomain);

bizUser. Url = crmDir + “BizUser. srf";

bizUser. Credentials = credentials;

Microsoft. Crm. Platform. Proxy. CUserAuth userAuth = bizUser. WhoAmI();

// CRMEmail proxy object

Microsoft. Crm. Platform. Proxy. CRMEmail email = new Microsoft. Crm. Platform. Proxy. CRMEmail();

email. Credentials = credentials;

email. Url = crmDir + “CRMEmail. srf";

// Set up the XML string for the activity

string strActivityXml = “";

strActivityXml += “";

strActivityXml += “";

strActivityXml += “";

strActivityXml += userId. ToString("B") + “";

strActivityXml += “";

// Set up the XML string for the activity parties

string strPartiesXml = “

Andrew Karasev is Chief Technology Officer in Alba Spectrum Technologies – USA nationwide Microsoft CRM, Microsoft Great Plains customization company, based in Chicago, Boston, San Francisco, San Diego, Los Angeles, Houston, Atlanta, New York, and Miami and having locations in multiple states and internationally ( ), he is Dexterity, SQL, VB/C#. Net, Crystal Reports and Microsoft CRM SDK developer.


Article Source:

Rate this Article: 
Microsoft CRM Development
Rated 1.0 / 5
based on 1 vote

Related Articles:

Microsoft CRM Customization - Programming Closed Email Activity

by: Boris Makushkin (February 21, 2005) 
(Computers and Technology/Software)

Microsoft CRM Customization Secrets - Second Edition

by: Andrew Karasev (February 22, 2005) 
(Computers and Technology/Software)

Microsoft CRM Implementation & Customization: MS CRM Fax Gateway

by: Andrew Karasev (June 29, 2005) 
(Computers and Technology/Software)

Microsoft CRM Implementation - Fundamental CRM Principles Revision

by: Andrew Karasev (March 23, 2005) 
(Computers and Technology/Software)

Microsoft CRM Integration with Microsoft Retail Management System (RMS) - ..

by: Andrew Karasev (May 06, 2005) 
(Computers and Technology/Software)

Microsoft CRM Integration With Microsoft Office Documents - Overview For System .

by: Andrew Karasev (March 26, 2005) 
(Computers and Technology/Software)

IT Department Skills to Support Microsoft Great Plains and Microsoft CRM

by: Andrew Karasev (September 09, 2004) 
(Computers and Technology/Software)

Productivity Tips for Web Developers And Mobile App Developers

by: Jayashree Mudaliar (May 30, 2016) 
(Computers and Technology/Programming)

Microsoft CRM or Siebel

by: Andrew Karasev (February 21, 2005) 
(Computers and Technology/Software)

Microsoft CRM Development

by: Andrew Karasev (April 29, 2005) 
(Computers and Technology/Software)