• Advertising
  • Advice
  • Affiliate Programs
  • Auto
  • Awards
  • Business
  • Careers
  • CGI
  • Computers
  • Communication
  • Copywriting
  • CSS
  • DHTML
  • Direct Mail
  • Domain Names
  • EBooks
  • ECommerce
  • Education
  • Email
  • Entertainment
  • Environment
  • Family
  • Finance
  • Fitness
  • Food
  • Free
  • Gardening
  • Government
  • Health
  • Hobbies
  • Home Business
  • Home Repair
  • HTML
  • Humor
  • Internet
  • Javascript
  • Law
  • Link Popularity
  • Management
  • Marketing
  • Marriage
  • Metaphysical
  • MLM
  • Motivational
  • Multimedia
  • Newsletters
  • Off-Line Promotion
  • Online Promotion
  • Other
  • Pets
  • Politics
  • Psychology
  • Publishing
  • Religion
  • Sales
  • Scams
  • Science
  • SE Optimization
  • SE Positioning
  • SE Tactics
  • Self Help
  • Sexuality
  • Site Security
  • Social Issues
  • Spam
  • Sports
  • Technology
  • Traffic Analysis
  • Travel
  • Viral Marketing
  • Web Hosting
  • Web Design
  • Webmasters
  • Weight Loss
  • Women's Issues
  • Writing
  • Product Review
  • Life Style
  • Celebrities
  • Online Business
  • Self Improvement and Motivation

  • 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.MessageiMessage = 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
    More articles:
    IM Lock Professional - Complete Instant Message Control for Business

    Security-Administrator

    Security Protector

    PublicPC Desktop

    Network Security Protector

    File and Folder Protector

    Easy-Desktop Keeper

    CDDVD Lock

    Backup for Outlook Express

    Advanced Security-Administrator

    AccessLock

    AccessAdministrator

    Access Administrator Pr

    1st Security Administrator Pro

    1st Security Administrator

    Files Repository have placed the new programs 4Movy DVD Ripper 2.2

    VSoft Technologies are pleased to announce the immediate availability of Automise, a software solution for automating tasks on Windows systems.

    AccentSoft Team Releases Office Password Remover 1.00Have you ever lost a password to a Microsoft? Excel or Word document? Would you really need it if it only took 15 seconds to create an exact, unprotected copy of the document? Recovering text from a pa

    Network LookOut Administrator Pro is Released

    Files Repository have placed the new programs Network DeepScan 2.5

    Simachov.com releases the easiest cataloging tool!

    Files Repository have placed the new programs Net Profile Switch 4.58

    Is your PC still starting up slowly?

    Your PC stores credit card information and private info!

    SWF Protect Remover

    advanced



       Reviews phones mobiles
       Free games
       Anunturi masini second hand
       Ziarul Buna ZIUA IASI
       Matrimoniale
       Auto-Dealer.RO
       website value
    Home     About Us     Services     Products     Support     Contact
    © Article Storage 2006 - 2012