Quantcast
Channel: Forum CRM Deployment
Viewing all articles
Browse latest Browse all 997

Not able to retrieve sales literature attachment documentbody data programmatically

$
0
0

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



Viewing all articles
Browse latest Browse all 997

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>