Home            Links 



 


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: 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(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 = "";


strPartiesXml += "";


strPartiesXml += "" + crmUser.GetEmailAddress() + "";


strPartiesXml += "" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() + "";


strPartiesXml += ""+ crmUser.GetId().ToString("B") + "";


strPartiesXml += "";


strPartiesXml += Microsoft.Crm.Platform.Types.ACTIVITY_PARTY_TYPE.ACTIVITY_PARTY_TO_RECIPIENT.ToString();


strPartiesXml += "";


strPartiesXml += "";


strPartiesXml += "";


strPartiesXml += "" + mailFrom + "";


if (objectType == Microsoft.Crm.Platform.Types.ObjectType.otAccount) {


strPartiesXml += "" + Microsoft.Crm.Platform.Types.ObjectType.otAccount.ToString() + "";


}


else if (objectType == Microsoft.Crm.Platform.Types.ObjectType.otContact) {


strPartiesXml += "" + Microsoft.Crm.Platform.Types.ObjectType.otContact.ToString() + "";


}


else if (objectType == Microsoft.Crm.Platform.Types.ObjectType.otLead) {


strPartiesXml += "" + Microsoft.Crm.Platform.Types.ObjectType.otLead.ToString() + "";


}


strPartiesXml += ""+ objectId.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 + "rn" + e.StackTrace); } 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 (if somebody knows the one - I owe you small pocket aquarium - smile!). 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(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 + "rn" + e.StackTrace);


} }


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


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 (www.albaspectrum.com), he is Dexterity, SQL, VB/C#.Net, Crystal Reports and Microsoft CRM SDK developer.



Advent Software to Host Analyst and Investor Day Event on Friday, May 11, 2012
Reuters
SAN FRANCISCO - February 6, 2012 - Advent Software, Inc. (NASDAQ: ADVS), will hold its Analyst and Investor Day in New York on Friday, May 11, 2012, beginning at 9:00 am (EST). The meeting will feature presentations by Advent's executive team covering ...
Advent Software Achieves Record Quarterly Revenue of $86 Million and Record ...MarketWatch (press release)
Advent Software's CEO Discusses Q4 2011 Results - Earnings Call TranscriptTheStreet.com
Advent Software Q4 Profit Drops; Issues Q1, FY12 Revenue Outlook - Quick FactsNASDAQ

all 13 news articles »


Scorpion Software Announces AuthAnvil Single Sign On Support for Level ...
San Francisco Chronicle (press release)
Scorpion Software, an industry leader in strong authentication and password management solutions for IT Service Providers and IT departments is pleased to announce integrated support for AuthAnvil Password Solutions with Level Platforms, ...
Scorpion Software Offers Support for Level Platforms Managed WorkplaceThe Complete Managed Services Resource

all 2 news articles »


Caduceus Software Plans to Integrate a Cloud Platform with its Software ...
SmallCap Network
By Ed Liston Caduceus Software Systems Corp. (OTC: CSOC), a software company specializing in the development of an all-in-one solution for private practitioners and doctors, today, said that it plans to integrate a cloud platform with software systems.
Caduceus Software Systems Corp. Plans to Integrate a Cloud Platform with its ...MarketWatch (press release)
QualityStocks News - Caduceus Software Systems Provides Update on Current ...PR Web (press release)

all 14 news articles »


Proposal Software Continues Strong SaaS Revenue Growth in 2011
MarketWatch (press release)
WESTPORT, Conn., Feb 06, 2012 (BUSINESS WIRE) -- Proposal Software, Inc. (PSI), The Leader In Proposal Productivity(TM), and makers of PMAPS(R) WebPro (Proposal Management and Production System) announced 2011 results that continue its systemic growth ...

and more »


Manhattan Software Announces Strategic Partnership With Indiabulls for ...
MarketWatch (press release)
6, 2012 /PRNewswire via COMTEX/ -- Manhattan Software, the global leader in enterprise real estate software and a leader in the 2011 Gartner Magic Quadrant for Integrated Workplace Management Systems, announced today a strategic partnership with ...

and more »


Mezeo Software Announces National Master Distributor for Japan
MarketWatch (press release)
HOUSTON, TX, Feb 06, 2012 (MARKETWIRE via COMTEX) -- Mezeo Software(R), a leading provider of cloud storage management solutions, today announced the appointment of a master distributor for Japan, AIR Company Limited, a Japanese company focused on ...

and more »


The Cloud Software Companies You Need to Know About
Motley Fool
But software as a service is easy enough to define. Whenever you have to access your application through a central location, and pay ongoing license fees to the developer, that's generally software as a service. Microsoft's Office suite is plain old ...

and more »


Is BMC Software Growing or Slowing?
DailyFinance
By Seth Jayson, The Motley Fool Posted 4:11PM 02/06/12 Investing There's no foolproof way to know the future for BMC Software (NAS: BMC) or any other company. However, certain clues may help you see potential stumbles before they happen -- and before ...

and more »


Oakland police get free forensic software to analyze Occupy videos
San Francisco Chronicle (blog)
A Pasadena forensic video enhancement software company has donated its technology to Oakland police to help in capturing the goings-on at Occupy Oakland demonstrations, the company announced in a statement. At the request of Oakland law enforcement, ...

and more »


Longwood Software Establishes Strategic Reseller Agreement with Canada's Interlinc
MarketWatch (press release)
MAYNARD, Mass., Feb 06, 2012 (BUSINESS WIRE) -- Longwood Software, Inc., the developers and marketers of the RevBase(R) software-as-a-service (SaaS) marketing asset management system ( www.revbase.com ), announced today a strategic reseller agreement ...

and more »

Google News

Related Articles
Microsoft Great Plains Remote Support - Overview
Microsoft Great Plains is now standard mid-market ERP application, serving the whole spectrum of businesses. In the case of mid-size business we usually see strong IT team with SQL querying skills plus accounting department is already trained to use Great Plains and needs minimal help in figuring out on how to use new Great Plains version and features. In this situation company may leverage it's work force strength and minimize ERP application support cost. This is the goal of Microsoft Business Solutions and the philosophy of future computer systems. In this situation - in our opinion - there is no need to have expensive local support when consultants are coming to you on regular basis and spend at least four hours onsite, charging somewhat close to $200 per hour.
MSN Messenger Is A Sweet Way To Communicate
MSN messenger is a pretty cool invention. I mean I'm not really into serious discussions on the email, answers to questions can often take a few days to arrive because people are so busy these days. I've just been 'hooked up' into Messenger and it's really a different kind of communication, quick, simplistic and even humorous with the capability to express your feelings with 'emotion' cartoons.
Chinese Input - Step by Step Instruction on How to Input Chinese Characters in English Windows XP
Enabling Chinese input is quick and easy, there are only a few steps you need go through to install the Chinese Language support and input method before you can type Chinese in your word processor or other program.
Software Engineering: An Introduction
Software Engineering is the Systematic Approach for analysis design implementation and maintenance of Software .It involve the use of Case tools. Computer software is the product that Software Engineers design and develop and virtually every one in the industrialized world use it and is important because it effects nearly every aspect of our lives and has became needy in commerce, culture and our every day life.
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. During the recession time a lot of former Great Plains Software and then Microsoft Business Solutions partners either went out of business or merged with Auditing firms and their Great Plains clients saw this instability and simply stopped annual enhancement program payments and become so-called orphan clients. Today, in 2005 ? it is time to upgrade from eEnterprise 6.0 to Microsoft Great Plains Professional 8.0. If you have major customization for eEnterprise ? you need to understand your options before you find your new Microsoft Business Solutions VAR of record. In this small article we will describe you the main steps and options to upgrade Dexterity customization:
Partitioning, Formatting and Reinstalling in Windows 98
Formatting and reinstalling windows 98 is very easy if you have the right know-how.
Exactly What Does FTP Stand for and What Can it do for Me?
FTP stands for "file transfer protocol". FTP is basically a way of sending files over the Internet.
Do You Want Your Own Fully Programmable ERP? - Part 1
We are in a transition phase in the Managerial Administration models of any company or Government, because three factors are summing for that:
Perfectly New Database Query Tool - Foxy SQL Pro Released
Are you a database professional? Do you work with a lot of databases? Do you use an SQL code? Do you want to connect to a new database to physically create its structure in no time and with ease? Are you tired of having to handle several client applications?
Microsoft Great Plains Upgrade ? Version 8.0 Overview for IT Director/Controller
If you have Microsoft Great Plains as main accounting and ERP system you need to know some technical details on Great Plains version upgrade and what is going on behind the scenes, which options do you have in case of Dexterity, VBA, SQL customizations, ctree/Pervasive migration to MS SQL/MSDE.  As of right now it is reasonable to upgrade to Microsoft Great Plains 8.0 Is upgrade required?  Not actually, but you have to consider these factors  ? Technical Support discontinuation - the old version may not be supported - currently if you are on version 6.0 - support is already discontinued.  You can not have Microsoft Business Solutions help you, but obviously you have MBS partners who can still help you.  If you are on Ctree or Pervasive SQL, then your support expires December, 31 2004.  ? Tax Updates/Magnetic media expiration - if you have US Payroll module and depend on it with W2 and other forms - you must stay with the version, which is supported and has tax updates.  If you are on Ctree or Pervasive SQL - then you will not have tax updates for these platforms at the end of 2004 and your W2s maybe inaccurate.  If you have a lot of employees - you may have issues with government.? Following the Technology and Microsoft rules  - Microsoft wants you to be on the newest platform and provides you the best support when you follow this rule? If you do have heavy customization - we recommend you to skip one version, for example if you are on version 7.5 - do not upgrade to 8.0 and wait for the next version What is upgrade in the language of technology?  Upgrade has server and client sides.  ? Server side - upgrade converts tables from old format to the new one.  In general words - Microsoft Business Solutions developers may change table structure, append additional fields to add new functionality, things like that.  Upgrade copies the table with changes to temporary table, then drops original table, recreates it with new structure and copies all the data from temp table to the newly created one.  ? Workstation side - workstation is written in Great Plains Dexterity and has Dynamics.exe - engine and DYNAMICS.DIC - dictionary.  These two plus all the additional files will be replaced with the new ones.  Other dictionaries, such us REPORTS.DIC and FORMS.DIC should be also upgraded and upgrade will try to deal with them automatically.  In some cases modified reports (in REPORTS.DIC) could not be upgraded and need to be recreated in the new version.  What is customization upgrade?  You should consider different types of customizations: Dexterity,  VBA/Modifier, SQL, ReportWriter, Crystal Reports? Dexterity Customization - being very short - Dexterity may have so called Custom Forms - these do not need upgrade - they should work as is.  Then Dexterity may alter existing Great Plains forms (so-called Alternate Great Plains forms) - in this case Dexterity customization should be redone for these forms/screens.  Plus additional consideration should be given to Dexterity triggers, shadow tables, etc.  ? VBA/Modifier customization - Modifier allows you to modify existing Great Plains windows - it creates so called modified Great Plains windows, stored in FORMS.DIC.  Usually modification is placing new buttons or fields, which in turn will be given VBA scripts (stored in DYNAMICS.VBA).  VBA scripts may call something nice, like Crystal Report, or have some data access logic.  Usually the old version of DYNAMICS.VBA workds with the new version.  You may need to rearrange buttons on the modified form.? SQL - you may have some stored procs for data integration, EDI or the like - if the addressed tables will be changed in the new version then you need to analyze your SQL code.  The good news is - Microsoft Business Solution doesn't make a lot of changes since version 7.0, because Microsoft is now trying to merge the products it owns: Great Plains, Solomon, Navision and Axapta - and so has different priorities? ReportWriter - MBS doesn't change tables, but it keeps changing Dexterity formulas used in ReportWriter original reports - this is the problem in so-called Modified Reports upgrade - usually you have these reports modified: SOP Blank Invoice form, SOP Blank Picking ticket, etc.   If report can not be upgraded - it should be redone in the new version with some exceptions.? Crystal Reports - the nice thing about Crystal Report - id doesn't need to be upgraded (if the fields in the tables exist in the new version - which is usually true statement)What is upgrade for third-party modules?  Your Great Plains may have so-called third party modules: Mekorma, Kampdata, Horyzon, Wennsoft, Avalara, Truepay, Trinity, Intellisol to name a fewThird party modules may have their own utility for upgrade.  You just need to know that your third-party is ready for the new Great Plains version - if not - you just wait and stay on the old version. What is migration from Ctree/Pervasive.SQL 2000 to MS SQL/MSDE?  MBS has migration tool.  You need first to install Great Plains on SQL Server with exactly the same account/segments structure and then install migration tool (it is Dexterity chunk) on your ctree/Pervasive workstation - then, when you integrate the chunk - you will map it to target SQL-based Great Plains Company, select all system and company tables, click the button and it will move all your tables one-by-one.  In the case when your Great Plains ctree/Pervasive has third parties - you need to check if the vendor has migration tool - otherwise you have to do manual move, use SQL Linked server to your legacy data Do I need consultant?  It is probably good idea to have consultant to do the upgrade.  We strongly recommend you to use consultant in the following cases? You have Dexterity customization? You are doing migration from Pervasive/Ctree to Microsoft SQL Server/MSDE, especially when you have third-parties without migration tools? You have a lot or ReportWriter Modified Great Plains Reports? You have old version of Great Plains: Dynamics or eEnterprise 6.0 or prior - in this case you can not appeal to Microsoft Technical Support - it is discontinued ? Your Great Plains has more than 20 users and you have to have upgrade done over the weekend - if it fails - you have business problems? You don't have support - in this case you have to select your Microsoft Business Solutions Partner and pay for the annual support/enhancement plan - you will get new registration key and will be ready for the upgrade  Good luck with upgrade and if you have issues or concerns ? we are here to help!  If you want us to do the job - give us a call 1-866-528-0577! help@albaspectrum.com
Microsoft Navision Database Selection: C/SIDE or MS SQL Server - Overview For IT Specialist
There are certain pluses and minuses in both cases and you should make your decision, based on your company needs. We'll give you some hints in this subject and you should know then where to look further.
Behave, Word, Behave!
If you copy something from a Web site or elsewhere... or you reuse a document and the formatting is making you crazy with its weirdness, then stop the insanity. The first option to make the document behave loses some of the formatting. You can always undo the changes if you don't like it by pressing CTRL+Z. To dump some of the formatting, press CTRL+A to select all and then select "Normal" from the style drop-down box in the left corner next to the AA as shown in the picture. This changes some of the formatting. If it's too much, remember CTRL+Z is there. If it's not enough, try option two.
Software Upgrades Arent Always the Best Move
When my daughter was getting into AOL instant messaging (AIM) and using all the cool add-ons, I looked for more as it's a great way to learn about extending applications. While doing research, I learned that if you wanted to use AIM themes, you don't want to upgrade to AIM 5.9. A post at MyThemes suggests sticking with or downgrading to 5.5. MyTheme shows what steps to take, should you prefer to stick with 5.9. The post also shows where to download 5.5 and how to downgrade back to it. Furthermore, 5.9 was bloated. Think it took a while for AIM to completely load in 5.5? 5.9 is worse.
Microsoft eCommerce Web-development: Great Plains eConnect .Net ? Highlights for Programmer
In our small article we'll consider Microsoft Business Solutions Great Plains Sales Order Processing module as eCommerce backend. Plus we'll cover what is possible and impossible in eConnect and why. Microsoft Great Plains is one of the most popular ERP in the US, Canada, Australia, New Zealand, Middle East, Latin America, UK and South Africa. Due to the MBS strategy ? Great Plains Dynamics was pulled from other markets, such as continental Europe (Germany, France, Russia) ? where Navision and Axapta are the promoted and recommended solutions. If you have Navision or Axapta ? please read our publications on these products on Alba Spectrum Technologies publication site.
Data Quality Best Practices for Salesforce.com
Executive Summary
Do You Know These Facts About Spyware ?
Imagine something that follows you home and sets itself up in your house. It eats your food, enjoys your drinks, reads everything you bring home or purchase. It runs up your phone bills and no matter where you go, it can follow you and takes notes on everything you do.
Defining OLAP Solutions and Data Warehouse design
This tutorial covers OLAP solutions used by Data warehouses and understanding Data Warehouse design. The enterprise needs to ask itself certain fundamental questions before actually launching on the process of designing the data warehouse. It must begin with a conviction that a data warehouse would really help its business and the return on investment will make it worth it.
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. So I regularly do a backup and reinstall all my software, including Windows.
The Bluebird Project
The objective for Zandi Digital is to make available clever programs to end-users that want and need something more diverse. Bluebird is the current application being developed by Zandi Digital. Bluebird will have the ability to compress multimedia(image, audio, or video) and text into one single file and later opened for reading or editing with Bluebird on Microsoft Windows® operating systems. A illustration is at http://www.videonotepad.net
The XP Firewall Isnt Enough
Every computer that connects to the internet has an IP address. This is like a sort of phone number, and is issued either to an individual computer or to a "gateway" that connects a private network to the 'net.



Common misspellings for words used in this page include abilty actualy adavanced addres addresed addtional adn adres adress adressed ahev ahve allready alreayd alsot alwasy alwyas amke amking anbd anual aplication applicaiton archetecture architechture aready artical artice articel aslo availaible availble availiable availible avalable avaliable avilable baceause bakc baout basicaly basicly bcak beacuse becamae becasue beccause becouse becuase bedore befoer beggin beng buisness busineses busness bussiness caperbility ceratin certian clasical cmoputer comany comapany comited comitted comming commited completelyl concider consdider constanly consulant coputer corparate coudl creaeted currenly dael decribe decribes descriibes desigining develope developped diea diferent diferrent differnt diffrent discribe discribes dissappointed doccument doign donig eiter enchancement ened Enlish enxt especialy everthing eveyr exemple exmaple expecially eyar eyars eyasr fidn follwoing folowing fomr frome fundametal gerat gogin goign gonig graet grat haev halp housr hten htere htey hting htis humerous hvae hvaing hvea hwihc hwile hwole idaeidae importamt includng incuding inlcuding inot intergrated iwll iwth jstu jsut knwo knwos konw konws kwno laguage larg lastr lefted leran liek liuke lsat maintainance maintainence maintance maintenence messanger messenging mkae mkaing mkea monts moreso mroe nkow nkwo nmae nowe nto oftenly oging omre onyl oppinion orginal origional otehr owrk owudl pary peopel performence philisophy philosphy physicaly populare possable possibile privte probablly probaly probelm proccess procedger proceedure proces processer promotted qtuie quicklyu qutie raelly realitvely realy realyl reccomend reccomended reccommend reccommended recomend recomended reconized regluar reguarly regularily relaly relativly relitavely remeber runing runnung severeal shaddow shoudl shoudln sicne simpley smae smoe soem sofware sould specfic specif spectum startegy stlye stong stpo stradegy stregth strenght stucture sturcture sytem sytle tahn taht targetted tath teh tehy temprary tghe thast theese ther theri thgat thge thier thign thigns thigsn thn thna thne thnig thnigs threee thrid thru thsi thta thyat tiem tihs timne tiome tje tjhe tkae tkaes transistion twpo tyhat tyhe uise unsed upgradded usally useing usualy ususally verison veyr vrey vyer vyre waht wass watn weas wehn whant whants whcih whic whihc whith whlch whn whta wich wih wiht wille witht witn wiull wnat wnated wnats wohle wokr workststion worls woudl writen wrok ws wtih wupport yearm yeasr yera yeras yersa ytou yuo.