I am using Dynamics CRM and am trying to download a file from the notes (annotation) entity. I am getting the Base64 String and converting to Byte[] like this:
Convert.FromBase64String((string)item.Attributes["documentbody"]);
But when I do so and try to open the file it is corrupt. Word Documents and PDFs refuse to open. Images however open partially. Ie. I get about 3/4 of the image but the rest of the image is solid grey.
I am guessing FetchXML is not returning the full string. Is there a way to to do this in FetchXML, overiding the limit? I have Googled but cannot see any mention of FetchXML limit?
There is a similar SO question here: FetchXml Query Returns Trimmed DocumentBody?
But I am not using "distinct" in my query.
Here is what I have so far:
<fetch>
<entity name="annotation" >
<attribute name="documentbody" />
<filter type="and" >
<condition attribute="objectid" operator="eq" value="{D4FFE0CD-CDFA-E711-80E4-005056BA77B6}" />
<condition attribute="isdocument" operator="eq" value="1" />
</filter>
<order attribute="modifiedon" descending="true" />
</entity>
</fetch>