Search code examples
.net-coredynamics-crmmicrosoft-dynamics

How can I upload a file to Dynamics?


Is there a way (API in Dynamics, supporting API in Azure) in Dynamics to upload a file to it? And by definition, a file is located in the file list for an account, contact, etc. so it would have to be pushed to the appropriate list for a given object.

I'm not asking for a recommendation (not allowed here), just how does Dynamics make this functionality available.


Solution

  • The short legacy version of the story is:
    The entity in which you can store a file in Dynamics is called annotation (common name: Note).

    The record it will be associated do is held in an entity reference field called "Regarding" (logical name: regardingid). The Regarding can be an account, contact, opportunity, etc.... (any entity that allows notes).

    The body of the file goes in as a Base64-encoded string.

    Following the standard WebAPI CRUD usage for the annotation entity should enable you to work with files in Dynamics.

    A start on the current version of the story can be found here, thanks to Jukka Niiranen.