I am working on a Dynamics 365 plugin to handle file attachments in Notes (annotation entity) and store them in an external system. The process works as expected when users add attachments via the binder in a Note: I can retrieve the file data from the documentbody attribute of the annotation entity using the IOrganizationService.
However, I am encountering an issue when users add attachments by drag-and-drop directly into the Note body.
In this case:
I do not want to use the API from within the plugin, so I am attempting to retrieve the file directly from the msdyn_richtextfile entity using the parsed GUID from the URL. According to the documentation, the file should be stored as a Base64-encoded value in the msdyn_fileblob attribute of the msdyn_richtextfile entity.
The problem is that when I retrieve the msdyn_richtextfile record using the GUID, the msdyn_fileblob attribute does not contain the file data. Instead, it holds another GUID, and I cannot find documentation or a clear method to resolve this to the actual file content.
I have tried getting both annotation and msdyn_richtextfile with this GUID from msdyn_fileblob but that did not work.
Questions:
Any insights or guidance would be greatly appreciated!
Best regards, Peter
Edited: When you want to download the file using the IOrgService you need to download the file in Chunks using following documentation:
Here you'll also find the code you used to download it using a single API request. So if you want to avoid the WebAPI you need to do the chunk approach.
Just to mention this here: It works differently for images as there is already the byte64 value in the request.