Dynamics 365 CE can anyone tell me where attachments/documents are stored for email templates. In must cases the attachment is not in the documentbody.
I have a process that creates a merged document by using the filename associated with the email template (works great) but I store the files on Azure (double the work), what I need to happen is to use the actual document attached to the template, but I do not know where the document is stored.
Hi partner,
Glad to hear that and thanks for your sharing :)
Best Regards,
Leo
Leo,
Thank you for taking the time to respond to my question. I to beleived that the attacment shouls be in the ActivityMemeAttachment entity in the "body" field using fetchxml I tried ever combination you could think of but the body field was always blank. Well at least I thought the field was blank after your response I try one more time and the field looks empty. Then I decided to select the field and copy it and guess what it has data.
Long story longer the PDF is in the ActivityMemeAttachment entity.
The attachment in email templates are stored in Attachment Entity in D365.
And the only way to retrieve it is accessing to "ActivityMimeAttachment" entity reference by webapi or C#.
Here's a sample code about how to get attachment in email template by C#.
https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/developer/sample-retrieve-email-attachments-email-template
From the sample code below, we could see how to get attachments in template.
https://github.com/microsoft/PowerApps-Samples/blob/master/cds/orgsvc/C%23/RetrieveEmailAttach/RetrieveEmailAttach/SampleProgram.cs
Here's the details for "ActivityMimeAttachment" entity reference.
https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/developer/entities/activitymimeattachment
We could also call webapi to get data we need from it.
Hope it helps.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Mansi Soni as our August 2025 Community…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Abhilash Warrier 100 Super User 2025 Season 2
Suresh Kulla 72 Super User 2025 Season 2
DAnny3211 54