![]() | |
![]() | |
![]() |
Software Information |
|
![]() |
Microsoft CRM Customization - Programming Closed Email Activity
Microsoft CRM is CRM answer from Microsoft and attempt to get market share from Siebel, Oracle and others traditional Client Relationship Management System vendors. Microsoft CRM uses all the spectrum of Microsoft recent technologies: .Net, MS Exchange, MS Outlook, MS SQL Server, Replication, Indexing, Active Directory, Windows 2000/2003 security model, C#, VB.Net, HTML, XML Web Service, XLTP, Javascript to name a few. Today's topic is Activity of email type programming - you usually deal with these customizations when you improve Microsoft Exchange CRM connector. How do you create closed activity - this is the main discussion topic. We'll use C#.Net coding One of the roles of our Exchange Event Handler/Sink is creation MS CRM Closed Activity in handling incoming and outgoing email messages. The interaction with Microsoft CRM uses two approached - using MS CRM SDK (handling inbound and outbound XML messages) and via direct access to MS CRM Database. Let's first look at the Closed Activity creation algorithm: 1. First we need to understand the entity we need to create activity for: Account, Lead or Contact. The selection should use specific criteria - in our case this is email address: if ((crmAccount = crmConnector.GetAccount(mailboxFrom)) != null) { } else if ((crmContact = crmConnector.GetContact(mailboxFrom)) != null) { } else if ((crmLead = crmConnector.GetLead(mailboxFrom)) != null) { } 2. Then we have to get GUID of MS CRM user, who owns this entity, C# code like this: crmUser = crmConnector.GetUser(crmAccount.GetOwnerId()); 3. Next step is closed Activity creation: emailId = crmConnector.CreateEmailActivity( crmUser.GetId(), Microsoft.Crm.Platform.Types.ObjectType.otAccount, crmAccount.GetId(), Microsoft.Crm.Platform.Types.ObjectType.otSystemUser, crmUser.GetId(), crmAccount.GetEmailAddress(), crmUser.GetEmailAddress(), sSubject, sBody); 4. The method to create closed activity: public Guid CreateEmailActivity(Guid userId, int fromObjectType, Guid fromObjectId, int toObjectType, Guid toObjectId, string mailFrom, string mailTo, 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 = ""; strPartiesXml += ""; strPartiesXml += "" + mailTo + ""; if (toObjectType == Microsoft.Crm.Platform.Types.ObjectType.otSystemUser) { strPartiesXml += "" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() + ""; } else if (toObjectType == Microsoft.Crm.Platform.Types.ObjectType.otAccount) { strPartiesXml += "" + Microsoft.Crm.Platform.Types.ObjectType.otAccount.ToString() + ""; } else if (toObjectType == Microsoft.Crm.Platform.Types.ObjectType.otContact) { strPartiesXml += "" + Microsoft.Crm.Platform.Types.ObjectType.otContact.ToString() + ""; } else if (toObjectType == Microsoft.Crm.Platform.Types.ObjectType.otLead) { strPartiesXml += "" + Microsoft.Crm.Platform.Types.ObjectType.otLead.ToString() + ""; } strPartiesXml += ""+ toObjectId.ToString("B") + ""; strPartiesXml += ""; strPartiesXml += Microsoft.Crm.Platform.Types.ACTIVITY_PARTY_TYPE.ACTIVITY_PARTY_TO_RECIPIENT.ToString(); strPartiesXml += ""; strPartiesXml += ""; strPartiesXml += ""; strPartiesXml += "" + mailFrom + ""; if (fromObjectType == Microsoft.Crm.Platform.Types.ObjectType.otSystemUser) { strPartiesXml += "" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() + ""; } else if (fromObjectType == Microsoft.Crm.Platform.Types.ObjectType.otAccount) { strPartiesXml += "" + Microsoft.Crm.Platform.Types.ObjectType.otAccount.ToString() + ""; } else if (fromObjectType == Microsoft.Crm.Platform.Types.ObjectType.otContact) { strPartiesXml += "" + Microsoft.Crm.Platform.Types.ObjectType.otContact.ToString() + ""; } else if (fromObjectType == Microsoft.Crm.Platform.Types.ObjectType.otLead) { strPartiesXml += "" + Microsoft.Crm.Platform.Types.ObjectType.otLead.ToString() + ""; } strPartiesXml += ""+ fromObjectId.ToString("B") + ""; strPartiesXml += ""; strPartiesXml += Microsoft.Crm.Platform.Types.ACTIVITY_PARTY_TYPE.ACTIVITY_PARTY_SENDER.ToString(); strPartiesXml += ""; strPartiesXml += ""; strPartiesXml += ""; log.Debug(strPartiesXml); // Create the e-mail object Guid emailId = new Guid(email.Create(userAuth, strActivityXml, strPartiesXml)); return emailId; } catch (System.Web.Services.Protocols.SoapException e) { log.Debug("ErrorMessage: " + e.Message + " " + e.Detail.OuterXml + " Source: " + e.Source); } catch (Exception e) { log.Debug(e.Message + "" + e.StackTrace); } return new Guid(); } 5. To make the activity just created be shown correctly you need to setup it's flags according to MS CRM standards: public void UpdateActivityCodes(Guid emailId) { try { OleDbCommand command = conn.CreateCommand(); command.CommandText = "UPDATE ActivityBase SET DirectionCode = (?), StateCode = (?), PriorityCode = (?) WHERE ActivityId = (?)"; command.Prepare(); command.Parameters.Add(new OleDbParameter("DirectionCode", Microsoft.Crm.Platform.Types.EVENT_DIRECTION.ED_INCOMING)); command.Parameters.Add(new OleDbParameter("StateCode", Microsoft.Crm.Platform.Types.ACTIVITY_STATE.ACTS_CLOSED)); command.Parameters.Add(new OleDbParameter("PriorityCode", Microsoft.Crm.Platform.Types.PRIORITY_CODE.PC_MEDIUM)); command.Parameters.Add(new OleDbParameter("ActivityId", emailId)); log.Debug("Prepare to update activity code " + emailId.ToString("B") + " in ActivityBase"); command.ExecuteNonQuery(); } catch(Exception e) { log.Debug(e.Message + "" + e.StackTrace); } } public void UpdateActivityQueueCodes(Guid emailId, Guid queueId) { try { OleDbCommand command = conn.CreateCommand(); command.CommandText = "UPDATE QueueItemBase SET Priority = (?), State = (?), QueueId = (?) WHERE ObjectId = (?)"; command.Prepare(); command.Parameters.Add(new OleDbParameter("Priority", Microsoft.Crm.Platform.Types.PRIORITY_CODE.PC_MEDIUM)); command.Parameters.Add(new OleDbParameter("State", Microsoft.Crm.Platform.Types.ACTIVITY_STATE.ACTS_CLOSED)); command.Parameters.Add(new OleDbParameter("QueueId", queueId)); command.Parameters.Add(new OleDbParameter("ObjectId", emailId)); log.Debug("Prepare to update activity queue code " + emailId.ToString("B") + " in QueueItemBase"); command.ExecuteNonQuery(); } catch(Exception e) { log.Debug(e.Message + "" + e.StackTrace); } } Happy customizing, implementing and modifying! If you want us to do the job - give us a call 1-866-528-0577! help@albaspectrum.com About The Author Boris Makushkin is Lead Software Developer in Alba Spectrum Technologies - USA nationwide Microsoft CRM, Microsoft Great Plains customization company, based in Chicago, Boston, San Francisco, San Diego, Los Angeles, Houston, Dallas, Atlanta, Miami, Montreal, Toronto, Vancouver, Madrid, Moscow, Europe and internationally (www.albaspectrum.com), he is Microsoft CRM SDK, C#, VB.Net, SQL, Oracle, Unix developer. Boris can be reached: 1-866-528-0577 or borism@albaspectrum.com.
MORE RESOURCES: Why These 15 Software Stocks Are Skyrocketing So Far in 2025 Insider Monkey What OpenAI’s Sales Automation Software Can Do—and What It Can’t The Information DMV rolls out new 605Drive software Dakota News Now Replit and Anthropic’s AI just helped Zillow build production software—without a single engineer VentureBeat Chip design software maker Cadence forecasts annual profit below estimate, shares down - Reuters.com DARPA Gets Word Out on Secure Software for Military National Defense Magazine FTC settlement requires disconnection of hardware from all no longer supported software Data Protection Report Iodine Software Launches Appeals Management Workspace Supporting Denials Management, Alongside GenAI Platform Enhancements Business Wire Telos Alliance Announces Axia Quasar V3.2 Software Update Sports Video Group The Impending Disruption That Will Transform IT and the Workforce: “Service-as-Software” Logistics Viewpoints Iodine Software Launches Appeals Management Workspace - HIT Consultant Commissioners approve new software for Lebanon Justice Court lebanonlocalnews.com Regula Software Now Supports the Latest Standard for Biometric Passport Verification - Business Wire Terma to supply C2 software for Slovakia’s Barak MX Airforce Technology CobbleStone Software Offers CobbleStone Contract Insight® CLM Solution Via Texas DIR Contract PR Web Raynault VFX, Stability AI Join the Academy Software Foundation Animation World Network FSF Opens Nominations For Free Software Awards iProgrammer 10 Hot Software Stocks with High Upside Potential Insider Monkey ECI Software Solutions Appoints Hildebrand CIO Quality Magazine Regula Software prend désormais en charge la dernière norme de vérification biométrique des passeports The Hastings Tribune Lucid Dream Software details benefits of new consumables platform Label & Narrow Web Researchers approach industry for commercial software dashboard to link legacy databases for decision-making Military & Aerospace Electronics Regula Software unterstützt jetzt den neuesten Standard zur biometrischen Reisepassprüfung The Hastings Tribune Regula Software unterstützt jetzt den neuesten Standard zur biometrischen Reisepassprüfung The Bakersfield Californian Blaize Holdings: Why I Am Betting On This AI Hardware And Software Small Cap (NASDAQ:BZAI) Seeking Alpha ezPaycheck Payroll Software Eliminates the Daunting Task of Tax Calculations for Business Owners Longview News-Journal Accenture: SDV requires transformational software mindset Automotive World France’s Cycloid gets €5M to promote efficient software delivery along with digital sobriety Silicon Canals Electronic Signature Software Market Is Booming Across the Globe:: DocuSign, Adobe Sign, HelloSign openPR Robot Software Market Hits New High | Major Giants Universal Robots, Yaskawa Motoman, Siemens openPR Creator Of New Open-Source Game Boy Disagrees That FPGA Is Superior To Software Emulation Time Extension AIDA64 now supports Radeon RX 9070 series, software drops support for Windows 95/98 - VideoCardz.com 2025.2.6 Official Tesla Release Notes - Software Updates Not a Tesla App Outside expands its outdoors media empire with acquisition of booking software developer The Colorado Sun PAC Programming Software Market Growth Outlook (2023-2032): Emerging Technologies Driving Innovation openPR |
![]() |
![]() |
![]() |
RELATED ARTICLES
The True Meaning of Freeware The vast majority of us will have, at some point, had freeware games or applications installed on our systems. If you've played an online Java or Flash based game, you've used freeware. An Easy Way to Develop JAVA Enterprise Applications Research bears that less than 70 percent of development projects are actually completed, and more than half come in late and over budget. AlachiSoft TierDeveloper is a Rapid Application Development tool that helps Software Developers do better, more creative, and useful work by reducing redundant hand coding. Microsoft Great Plains Integrations - Retail Management Sample Microsoft Business Solutions is emerging as very attractive vendor for mid-size companies. The strength of its products is in their cross integration potential. Document Templates Give You The Perfect Framework For Your Documents When it comes to running an office, the SOHO entrepreneur has enough on his or her plate as it is. So if you find yourself in the unenviable position of regularly having to set aside your core competencies to handle tedious, repetitive administrative duties such as creating your business documents from scratch, then you need to consider the potential benefits offered by document templates. Putting Screensavers Under Control No matter how much you enjoy your favorite screensavers, sometimes they can be rather annoying. Don't like them interrupting your presentations? Hate them disturbing you watching movies? Look no further. These Items Are A Must Before Making The Decision To Purchase Any Off-The-Shelf Software 1. What determines the software price? Is it Per Seat or Per User or Per Processor?The cost of software is determined in many ways. Beware of Spyware One day, you suddenly realize that your computer started to worknoticeably slower than it used to. You decide to run de-fragmentation of your hard drive and add more virtual memory to the system. A Simple Computer Software Definition What is Software?Software is a set of instruction written to interface between man and machine.Who writes this instructions?Programmers writes this instructions. How to Choose the Right Accounting Software for Your Business With any good luck and a good amount of hard work, you'rehaving the same problem many business owners today arefacing. Your business is growing rapidly and you're havingproblems controlling your finances. Benefits of Integrating Online Chat Software with CRM Customer Relationship Management (CRM) is a strategy and processes used to learn more about customers' needs and behaviors in order to develop stronger relationships with them. CRM applications are traditionally developed as client-server software. Microsoft CRM USA Nationwide Remote Support Remember old good days when your company probably had Great Plains Dynamics? If you are in San Francisco Bay Area - you had local Great Plains Software partner consulting company, who served you basically coming onsite and charging you four hours minimum, even if the problem deserved 5-min fix? This was at the end of 20th century and remote support technologies were not very advanced - Citrix was making good progress and taking market over from Symantec PCAnywhere. Today, when Microsoft Terminal Server and Citrix are remote support standards and IT department uses them to host application server for nation-wide and world-wide users, you should probably be thinking of getting remote support for your ERP and CRM systems. Reloading Windows XP If you have been running Windows XP for a couple of years or more you may find that it is not running quite as quickly and smoothly as it was when you did your first install. I am constantly 'evaluating' software and uninstalling and reinstalling beta software on my computer and have always gradually become more and more disappointed after nine months to a year with the performance of my PC. How to Evaluate Staffing Software If you are in the market for new staffing software, I suspect that one of the most daunting of tasks will be to sift through the many vendors that are now servicing the staffing industry.You will find many very qualified companies with good staffing software products. Free Software: How Not To Get More Than You Bargained For! I completed an experiment recently. I wanted to find out exactly what software I could get free on the Internet. EDI: Electronic Document Interchange for Microsoft Great Plains - Overview for Software Developer/Pr Microsoft Great Plains - Microsoft Business Solutions accounting and ERP system, originally targeted to mid-size - now, with advancements and increasing reliability of its database - Microsoft SQL Server, Great Plains is attractive solution for large corporation. Big companies usually have purchasing and order processing automation via so-called Electronic Document Interchange or EDI. Does your Company have Documentum? Are you lost in the mess of documents that get passed around your company, never knowing what the latest version is and which one you should work on without worrying if someone else has already made the same editions that you are making? Perhaps you have heard of collaboration software solutions such as Documentum to help your company manage its documents that are passed around. Documentum is a very good solution to this problem but is it the only one? In this article you will be presented with some basic information about the differences in collaboration software from Documentum and NextPage. Microsoft CRM for Corporate Business - Working Offline If your company has regional and worldwide operations, you might already realized that it is very hard to get decent internet connection in your remote locations. In this small article we will try to give you highlights on how to implement Microsoft Business Solutions CRM for worldwide operations with restricted internet connection. PHP On-The-Fly! IntroductionPHP can be used for a lot of different things, and is one of the most powerful scripting languages available on the web. Not to mention it's extremely cheap and widely used. Great Plains Sales Order Processing and Invoicing Modules - Tips For Consultants We'll give you non formal view, based on our consulting practice.Common Features. Microsoft Great Plains Customization Recovery & Upgrade for Large Corporation At the end of XX century, in the late 1990th Great Plains Software eEnterprise was recognized as one of the leader on the midsize to large corporate ERP market. Due to the nature of eEnterprise architecture - it is Great Plains Dexterity based application and Dexterity imposes some specific to the database access and table structure - eEnterprise was subject to relatively inexpensive customization. ![]() |
home | site map |
© 2006 |