Problem while adding/opening .pdf attachment to Email activity RRS feed

  • Question

  • Hi,

     I get "base64" data in a XML file, which i get from client on daily basis . I need to save the content to "Email activity" as '.pdf' attachment using WCF service. I am using below code in service to do this

    //Creation of Email Activity 

    email email = new email();  

    email.description = "Desc"; 

    email.subject = "Sub";  

    Guid emailID = crmService.Create(email);

    //Create 'Attachment' activity  

    activitymimeattachment attachment = new activitymimeattachment();  

    attachment.mimetype = "application/pdf";

    //Adding 'Base64Data' which i get from xml file from client to the 'body' field

    attachment.body = "VBERi0xLjQNJeLjz9MNCjI5IDAgb2JqIDw8L0xpbmVhcml6ZWQgMS9MIDYxfNTaNjWLhy";  

    attachment.filename = 

    Lookup emailActivityId = new Lookup();  

    emailActivityId.Value = emailID;

    attachment.activityid = emailActivityId;

    // Create the attachment in CRM 

    Guid attachmentID = crmService.Create(attachment);

    ---> With this code i am able to create 'Email Activity' with '.pdf' attachment. But i am getting 'File is currupted' error when i try to open the '.pdf' attachment. Can any one please tell me the way to resolve this.









    Thursday, September 16, 2010 1:33 PM