Activity Guide
 
HOME | CONTACT US | SITE MAP

Recent Searches:
Search: Activity
Search: Athletics
Search: Workout Gear

Partner Sites:
Web Inceptions, Inc.
Domain Name Sales
Domain Registration Alerts


New Sites:
Supernatural Photography
Bargain Scrapbooks
Challenge Workshop
Virtual Pets
Reconcilable Differences
The Love Bible
Advanced Navigation
PUA
Hyper Seduction
Advanced Defense
Party Confidential
Spice Chefs
Adventure Climbers
Independent Cycling
Organic Parenting
Affordable Beach Living
Coach Promotion
Nightlife Photographer
Affordable Home Broker
Interior Updates
Real Estate Bailout
Serenity Photography
Advanced Exports
Enhanced Photography
Smart Custody
Adventure By Nature
The Wine You Love
Bridal Insight
Inspirational Instruction
Coral Adventures
ActivityGuide.info
Tuesday, March 09, 2010


Microsoft CRM Customization: programming email activity attachment

Microsoft CRM Customization – programming email activity attachment by: Boris Makushkin

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 + "\r\n" + 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 + "\r\n" + 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(at)albaspectrum. com

Author:
Boris Makushkin

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



More great sites:
Property Specialist | Protect My Home | Publicity Connection | Publicity Wire | Quality Ratings | Rainbow Factory | Rare Realty | Real Estate Carlsbad | Real Estate Delmar | Real Estate Sales Tools | Real Estate Showplace | Real Estate Showroom | Real Property Exchange | Realty Honolulu | Realty Liquidators | Realty Questions and Answers | Reduce Your Taxes | Renew Your Home | Rental Income | Rental Listings | Resort Homes | Resort Timeshare | Resume Source | Retail Image | Retire Well | Rewarding Excellence | Romance Expert | Rumor Channel | Run Fun | Sail Buy | Sailing Adventure | Sailing Place | Sail Source | Sail Spot | Salary Facts | Salary Index | Sale Desk | Sand Scape | Scentual Gifts | Schedule Alerts | Scrapbook Party | Script Expert | Scuba Diving Hawaii | Scuba Experts | Seafront Homes | Seashell Cove | Secret Whisper | Select Property | Selling Expert | Sell Talk | Senior Buy | Senior Edge | Senior For Hire | Senior Living Today | Service Alert | Showcase Photography | Showcase Records | Show Your Pet | Signature Check | Signature Scan | Simply Trim | Slim Guide | Smart Listing | Smile Wizard | Smog Repair | Snorkel guide | Solution Driven | Spa Diet | Spa Repair | Special Engagement | Specialty Antiques | Spontaneously | SQL Weekly | Startup Financing | Staying Fit | Stock Market Insight | Stock Play | Surf Guide | Survey The Web | Systematically |

Do you have a web site? Please link to us!


ActivityGuide.info: Microsoft CRM Customization: programming email activity attachment

More Activity information:

Article: Law School Torts II Course Outline Law School Torts II Course Outline

Article: Pointless Targets Pointless Targets

Article: Mental vs Physical Activity in Marketing Mental vs Physical Activity in Marketing

Article: Microsoft CRM Customization: programming Closed Email Activity Microsoft CRM Customization: programming Closed Email Activity

Article: Exercise For Any Size Exercise For Any Size

Article: Burn Fat  24 Hours a Day - Increase Your Metabolic Rate Burn Fat 24 Hours a Day - Increase Your Metabolic Rate

Article: Ready?Set?Go! Transition Strategies for Caregivers Ready?Set?Go! Transition Strategies for Caregivers

Article: Physical Activity and Less? Physical Activity and Less?

Article: Influences On Whitetail Deer Activity Influences On Whitetail Deer Activity

Article: Playing Games Does Not Help Your Weight Loss Efforts Playing Games Does Not Help Your Weight Loss Efforts

Article: Peak Performance? What You See Is What You Get! Peak Performance? What You See Is What You Get!

Article: A Blowing Bubble Activity that will Blow the Kids Away A Blowing Bubble Activity that will Blow the Kids Away

Article: Home Spa and Bodys Adaptation. The More the Better? Home Spa and Bodys Adaptation. The More the Better?

Article: Microsoft CRM Customization: programming email activity attachment Microsoft CRM Customization: programming email activity attachment

Article: Wheres the Water? Wheres the Water?

Article: Vitamin Tips To Fuel Physical Activity Vitamin Tips To Fuel Physical Activity

Article: Dieting? Mental Activity is as Important as Physical Dieting? Mental Activity is as Important as Physical

Article: Incorporating Physical Activity into Your Daily Routine Incorporating Physical Activity into Your Daily Routine

Article: Microsoft CRM Customization? Programming Closed Email Activity Microsoft CRM Customization? Programming Closed Email Activity

Article: Develop Your Childs Genius - Right Brain/Left Brain Coordination Develop Your Childs Genius - Right Brain/Left Brain Coordination

Article: Microsoft CRM Customization secrets: second edition Microsoft CRM Customization secrets: second edition

Article: Beware of the Newest Activity Online Phishing Beware of the Newest Activity Online Phishing

Article: Great Activities and Adventures in Kauai Great Activities and Adventures in Kauai

Article: How Many Calories Are Too Many How Many Calories Are Too Many

Article: Why they are mistaken about Aerobic Activities Why they are mistaken about Aerobic Activities


Activity
Athletics Workout Gear

Related Items:
Travel
Sports
Activity Ride
Activity
Technology
Fitness
Camping
Crafts
Hiking
Adventure Travel
Self Tanning
Walkthroughs
Psychonauts
Activity Options
Stanford Sports
Stanford Athletics
Animal Activities
Dartmouth Sports
Health Word
Ole Miss Athletics
Marquette University Athletics
Harwood Auto
Wisconsinopoly
Cub Scout Outdoor Activity Award
Operation
California Missions
North Carolina Football
Dartmouth Football
Buddy Teevens
Viking Athletics
Halloween School
Have Fun With Math
Michiganopoly
Purdueopoly
Metal Gear Solid 2 Strategy Guide
Stanford Football
Stanford Basketball
Music Activity
Penn State Basketball
Lacrosse Photos
Mississippi Football
Social Studies Activity
Dukeopoly
Texasopoly
Step
Aurora University
Enter The Matrix Xbox
Enter The Matrix Game
Spanish Activity
Brazil Volleyball
Penn Stateopoly
Teaching Reading In Social Studies
References
Doom 3
Strategy Guide
Auburnopoly
Pocket Guide
Math Resources
Womens Lacrosse
Math Products
Wow Game Guide
Worship
Comprehension Activities
Mechassault
Science Lesson Plans
Help
Education
Jobs
School
Job
Training
Careers
Schools
Teaching
Leadership
Yoga
Travel Guides
Find A Job
Workout
Tanning
Pilates
Aerobics
Emergency Preparedness
Meditations
Pc Game
Toning
Whiplash
Kickboxing
Safety Training
Trailblazer
Weight Training
Strategy Game
Financial Help
Timekeeping
Search People
Activity Books
Fishfinder
Security Product
Search For People
Time Recording
Meditation Techniques
Math Activities
Job Career
Vin Search
Indoor Cycling
Fish Finders
Sun Tanning
Ait 2
Reading Activities
Education Careers
Workout Wear
Ait 3
Workout Gear
Total Body Workout
Fitness Gear
Math Tools
Gym Shorts
Fitness Clothing
Athletic Clothing
Web Host Reviews
Data Security Software
Campaign Buttons
Teaching Geography
Mortgage Faq
Exercise Clothing
Exercise Clothes
30 Minute Workout
Gym Gear
Volleyball Tour
Basketball Dvd
Deb

 
Copyright © 2000-2006 ActivityGuide.info. All Rights Reserved.
Home | Contact Us | About Us | Site Map | Add URL