| This article is for advanced Microsoft CRM | | | | Microsoft.Crm.Platform.Proxy.CRMEmail();email |
| SDK C# developers. It describes the technique | | | | .Credentials = credentials;email.Url = crmDir |
| of direct SQL programming, when SDK doesn't | | | | + "CRMEmail.srf";// Set up the XML string for |
| have the functionality to do the | | | | the activitystring strActivityXml = |
| job.Introduction. Looks like Microsoft CRM | | | | "";strActivityXml += "";strActivityXml += "") |
| becomes more and more popular, partly because | | | | + "]]>";strActivityXml += "";strActivityXml |
| of Microsoft muscles behind it. Now it is | | | | += userId.ToString("B") + "";strActivityXml |
| targeted to the whole spectrum of horizontal | | | | += "";// Set up the XML string for the |
| and vertical market clientele. It is tightly | | | | activity partiesstring strPartiesXml = |
| integrated with other Microsoft Business | | | | "";strPartiesXml += "";strPartiesXml += "" + |
| Solutions products such as Microsoft Great | | | | crmUser.GetEmailAddress() + "";strPartiesXml |
| Plains, Solomon, Navision (the last two in | | | | += "" + |
| progress).Here we describe the technique of | | | | Microsoft.Crm.Platform.Types.ObjectType.otSys |
| creating closed activity-email using MS CRM | | | | temUser.ToString() + "";strPartiesXml += ""+ |
| SDK and direct SQL programming.Imaging | | | | crmUser.GetId().ToString("B") + |
| something like this. You need to handle | | | | "";strPartiesXml += "";strPartiesXml += |
| incoming email before it is committed to MS | | | | Microsoft.Crm.Platform.Types.ACTIVITY_PARTY_T |
| Exchange database. You need to analyze if | | | | YPE.ACTIVITY_PARTY_TO_RECIPIENT.ToString();st |
| incoming email doesn't have GUID in its | | | | rPartiesXml += "";strPartiesXml += |
| Subject (GUID will allow MS CRM Exchange | | | | "";strPartiesXml += "";strPartiesXml += "" + |
| Connector to move email to Microsoft CRM and | | | | mailFrom + "";if (objectType == |
| attach it to the Contact, Account or Lead) - | | | | Microsoft.Crm.Platform.Types.ObjectType.otAcc |
| then you still need to lookup MS CRM in case | | | | ount) {strPartiesXml += "" + |
| if one of the accounts, contacts or leads has | | | | Microsoft.Crm.Platform.Types.ObjectType.otAcc |
| email address that matches with sender email | | | | ount.ToString() + "";}else if (objectType == |
| address - then you need to create closed | | | | Microsoft.Crm.Platform.Types.ObjectType.otCon |
| activity-email in MS CRM, attached to the | | | | tact) {strPartiesXml += "" + |
| object and placed into general queue.How to | | | | Microsoft.Crm.Platform.Types.ObjectType.otCon |
| create MS Exchange handler is outside of the | | | | tact.ToString() + "";}else if (objectType == |
| scope, please see this article: the code | | | | Microsoft.Crm.Platform.Types.ObjectType.otLea |
| below is classical MS CRM SDK and it will | | | | d) {strPartiesXml += "" + |
| create activity email:public Guid | | | | Microsoft.Crm.Platform.Types.ObjectType.otLea |
| CreateEmailActivity(Guid userId, int | | | | d.ToString() + "";}strPartiesXml += ""+ |
| objectType, Guid objectId, string mailFrom, | | | | objectId.ToString("B") + "";strPartiesXml += |
| CRMUser crmUser, string subject, string body) | | | | "";strPartiesXml += |
| {try {log.Debug("Prepare for Mail Activity | | | | Microsoft.Crm.Platform.Types.ACTIVITY_PARTY_T |
| Creating");// BizUser proxy | | | | YPE.ACTIVITY_PARTY_SENDER.ToString();strParti |
| objectMicrosoft.Crm.Platform.Proxy.BizUser | | | | esXml += "";strPartiesXml += "";strPartiesXml |
| bizUser = new | | | | += "";log.Debug(strPartiesXml);// Create the |
| Microsoft.Crm.Platform.Proxy.BizUser();ICrede | | | | e-mail objectGuid emailId = new |
| ntials credentials = new | | | | Guid(email.Create(userAuth, strActivityXml, |
| NetworkCredential(sysUserId, sysPassword, | | | | strPartiesXml));return emailId;}catch |
| sysDomain);bizUser.Url = crmDir + | | | | (System.Web.Services.Protocols.SoapException |
| "BizUser.srf";bizUser.Credentials = | | | | e) {log.Debug("ErrorMessage: " + e.Message + |
| credentials;Microsoft.Crm.Platform.Proxy.CUse | | | | " " + e.Detail.OuterXml + " Source: " + |
| rAuth userAuth = bizUser.WhoAmI();// CRMEmail | | | | e.Source);}catch (Exception e) |
| proxy | | | | {log.Debug(e.Message + " |
| objectMicrosoft.Crm.Platform.Proxy.CRMEmail | | | | |
| email = new | | | | " + e. |