locked
Not able to retrieve sales literature attachment documentbody data programmatically RRS feed

  • Question

  • Hi,

    Today I found 1 weird bug in CRM 2013 online. 

    I am trying to download the sales literature attachment programmatically but the problem is, the documentbody field data that I am getting is only of 2KB size but in actual file is of 800kb.

    And the worst part is, the same file I am able to download programmatically if I attach the same file in email or notes.

    This issue is only happening in CRM online and working perfectly in CRM on-premise.

    Source Code:

    EntityCollection collectionSL = service.RetrieveMultiple(new FetchExpression(salesattachmentXml));
    foreach (Entity salesLiterature in collectionSL.Entities)
        {

    String DocumentBody = Helper.GetNotNullAttributeValue<String>(salesLiterature, "documentbody");

    byte[] byteData = Convert.FromBase64String(DocumentBody);

     using (FileStream fileStream = new FileStream(filename, FileMode.OpenOrCreate))
    {
          fileStream.Write(byteData, 0, byteData.Length);
    }

    }

    Please help.

    Thanks

    Megh


    • Edited by MeghShyam.Gaur Tuesday, December 23, 2014 4:33 PM Added some more text
    Tuesday, December 23, 2014 4:30 PM

All replies