Related Links

Featured Links





Recommended Products



 

 
Featured Articles

10 Helpful Tips For Running A Profitable Web Site
1. Address your targeted audience on your business site. Example: "Welcome Internet Marketers". If you have more than one, address them all.2. Make sure your content and graphics are relevant to your web site's theme. You wouldn't want to use a bird ...

Accept Credit Cards Online without a Merchant Account
It is often assumed if you want to accept credit cards on your website that you must have a merchant account. This is not the case. You can accept credit cards with a Third Party credit card processor. 1) What is a Third Party Credit Card Processor? A ...

Off The Record - Tips For Picking Recording Software
Need software to record your voice, streaming audio or musical instruments? There are dozens of great products on the market. Some cost up to five hundred dollars, but here are some of the low cost alternatives you might want to consider.n-Track StudioThe ...


Google
Microsoft CRM Customization – programming email activity attachment
 

Microsoft CRM is now on the scene and it is increasing its market share, due to Microsoft Business Solutions muscles and marketing strategy. It is tightly integrated with other Microsoft Business Solutions products such as Microsoft Great Plains, Solomon, Navision. Being relatively inexpensive in comparison to competitors, like Siebel, Oracle - Microsoft CRM opens you the door for worldwide operations automation. In this small article we would like to give you, software developer, some hints on Microsoft CRM customization.


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 email attachment - this is the main discussion topic. We’ll use C#.Net.


In Exchange handler/event sink you create Activity of email type in MS CRM and one of the tasks is transfer the attachment(s) from the body of the incoming email to the attachment(s) in the Activity. You can realize it through direct access to Microsoft CRM DB. Let’s see C# code:


1. First we are getting access to the letter via ExOLEDB:



CDO.Message iMessage = new CDO.MessageClass();

CDO.IBodyPart iPrt;



iMessage.DataSource.Open(bstrURLItem, null, ADODB.ConnectModeEnum.adModeRead,



ADODB.RecordCreateOptionsEnum.adFailIfNotExists, ADODB.RecordOpenOptionsEnum.adOpenSource, ", ");




2. Next – we come through the attachment list, get their names and save their bodies into temporary catalogue:



for(int i = 1; i ";

strXml += "Activity 1";

strXml += " + attachmentNumber + ";

strXml += " + emailId.ToString("B") + ";

strXml += ";



// Create the activity attachment

Guid attachmentId = new Guid(activityAttachment.Create(userAuth, strXml));

log.Debug("Create Attachemnt ID: " + attachmentId.ToString("B"));



UploadFileToDB(attachmentId, filename, filesize);



return attachmentId;

}

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. Main problem, however is attachment body adding to MS CRM database. Main requirement is – attachment must be encoded as BASE64 stream and its length must be specified correctly together with Nine Type and file name of the file it will be knows as an attachment in activity. Let’s look at the C# code:



public void UploadFileToDB(Guid attachmentId, string filename, long filesize) {

string contentType =


"application/octet-stream";



try {

Hashtable mimes = LoadMimeDB(Environment.SystemDirectory + "/Albaspectrum/ContentType.txt");



if (mimes != null) {

string tmpContentType = GetMimeType(mimes, filename);



if (tmpContentType != null && !tmpContentType.Equals("))

contentType = tmpContentType;

}



byte[] memoryData = new byte[filesize];



FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read);

BinaryReader reader = new BinaryReader(fs);



reader.Read(memoryData, 0, (int)filesize);



reader.Close();

fs.Close();



OleDbCommand command = conn.CreateCommand();



command.CommandText = "UPDATE ActivityMimeAttachment SET FileSize = (?), MimeType = (?), FileName = (?), Body = (?) WHERE ActivityMimeAttachmentId = (?)";

command.Prepare();

command.Parameters.Add(new OleDbParameter("FileSize", filesize));

command.Parameters.Add(new OleDbParameter("MimeType", contentType));

command.Parameters.Add(new OleDbParameter("FileName", new FileInfo(filename).Name));

command.Parameters.Add(new OleDbParameter("Body", Convert.ToBase64String(memoryData, 0, (int)filesize)));

command.Parameters.Add(new OleDbParameter("ActivityMimeAttachmentId", attachmentId));



log.Debug("Prepare to upload attachemnt " + attachmentId.ToString("B") + " in ActivityMimeAttachment");



command.ExecuteNonQuery();



memoryData = null;

}

catch (Exception e) {

log.Debug(e.Message + "
" + e.StackTrace);

}

}




6. File ContectType.txt is matching list of the files extensions and their mime-type in the following format:



asc application/pgp-encrypted Armored Encrypted file (PGP)

asd application/astound Autosave file (Word for Windows)

asm PC ASM File

asn application/astound




etc.


Happy customizing, implementing and modifying! If you want us to do the job - give us a call 1-866-528-0577! help@albaspectrum.com






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, Moscow and Europe and internationally (www.albaspectrum.com), he is Microsoft CRM SDK, C#, VB.Net, SQL, Oracle, Unix developer.

borism@albaspectrum.com





News



IBNLive.com

Apple software exec accepts Grammy on Steve Jobs' behalf
SlashGear
At yesterday's ceremony, accepting the award was Apple's senior vice president of Internet Software and Services, Eddy Cue. Cue had worked closely with Jobs for 15 years and was the one responsible for carrying out many of Jobs's dreams and visions in ...
Steve Jobs gets a Grammy for work on the iPod and iTunesVentureBeat
Glen Campbell, Diana Ross, George Jones, Allman Brothers, More Honored at ...Billboard.biz
Diana Ross, Steve Jobs honored at Grammy ceremonyCBS News

all 142 news articles »

USA TODAY

Oracle buying software maker Taleo Corp. for $1.9 billion
Business Mirror
SAN FRANCISCO—Oracle Corp. said it's going to buy Taleo Corp. for $1.9 billion, highlighting the software behemoth's aggressive bid to build up its cloud computing capabilities. Oracle said it is acquiring Taleo for $46 a share, an 18 percent premium ...
Oracle Pays $1.9 Billion to Acquire Taleo's HR SoftwareBusiness 2 Community
Oracle Broadens Reach in Web-Based SoftwareWall Street Journal
Oracle to buy Taleo for $1.9 billionBusiness Recorder (blog)
Forbes -ABC News
all 132 news articles »

STYLEMAKER SPOTLIGHT: Bryan Burkhart - Software geek to flower power
San Francisco Chronicle
Bryan Burkhart went from a $100 million software startup to co-founding flower service H.Bloom. Bryan Burkhart may be the only florist you'll ever meet who joined a software startup when he was 23 and helped grow it to $100 million in revenue and an ...

and more »

ND SOFTWARE CO LTD
BusinessWeek
Nd Software Company Ltd engages in the development and maintenance of software packages for healthcare industries in Japan. The company also provides support software. It offers products for care services, persons with disabilities and welfare, ...


PR Web (press release)

CTS Adds Review of NetSuite Manufacturing Edition to its Manufacturing ...
PR Web (press release)
Comprehensive review by CTS President, Sheldon Needle, examines the latest cloud-based manufacturing software solution from NetSuite, Inc., which supports light manufacturing as well as complex operations. NetSuite Manufacturing Edition is a ...

and more »