locked
CRM 4.0 to 2011 Plugin: How to use CrmNumber() in 2011 plugin RRS feed

  • Question

  • Hello...I am trying to modify code that was written for 4.0 into 2011.

    The problem I am having is with the CrmNumber() function and using it to attach a pdf report in a plugin.

    Here is the line of code. It is from this blog: http://ekoncis.blogspot.com/2012/01/crm-2011-custom-email-with-pdf-report.html

    // Attaching Pdf report
    //LINE BELOW NEEDS TO BE RE-WRITTEN
    CrmNumber crmNextActorID = new CrmNumber();
    
     RetrieveEntityRequest request = new RetrieveEntityRequest();
    request.LogicalName = "email";
    RetrieveEntityResponse response = (RetrieveEntityResponse)service.Execute(request);
    int objecttypecode = response.EntityMetadata.ObjectTypeCode.Value;                
    Entity attachment = new Entity("activitymimeattachment");
    attachment.Attributes.Add("subject", "Report");
    attachment.Attributes.Add("filename", "Report.pdf");
    attachment.Attributes.Add("body", Convert.ToBase64String(result));
    
    //LINE BELOW NEEDS TO BE RE-WRITTEN
    attachment.Attributes.Add("filesize", new CrmNumber(Convert.ToInt32(result.Length.ToString())));
    
    


    Mike Karls

    Wednesday, June 11, 2014 7:24 PM

Answers

All replies