web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Access D365 Attachments Using PowerApp or Power Automate

(2) ShareShare
ReportReport
Posted on by 83
How can I access attachment files in D365 F&O (such as .docx) from my PowerApp or using Power Automate?
Categories:
I have the same question (0)
  • Jonas "Jones" Melgaard Profile Picture
    4,894 Super User 2025 Season 2 on at
    Access D365 Attachments Using PowerApp or Power Automate
    Hi MohammedAfeef,
     
    What is the D365 product? F&O, BC, Sales etc
  • Daivat Vartak (v-9davar) Profile Picture
    7,835 Super User 2025 Season 2 on at
    Access D365 Attachments Using PowerApp or Power Automate
    Hello MohammedAfeef,
     

    You can access attachment files in Dynamics 365 (Dataverse) from your Power Apps or Power Automate flows using a combination of Dataverse connectors and specific actions. Here's a breakdown of the methods and considerations:

    Understanding Attachments in Dataverse:

    • Annotation Entity: Attachments are stored within the annotation entity in Dataverse.
    • DocumentBody Field: The actual file content is stored in the documentbody field of the annotation record.
    • MIME Type: The mimetype field indicates the file type (e.g., application/vnd.openxmlformats-officedocument.wordprocessingml.document for .docx).
    • Object ID: The objectid field links the annotation to the related record (e.g., a Contact, Account, or Case).

    •  

    Accessing Attachments in Power Apps:

    1. Add a Dataverse Data Source:

      • In your Power App, add the Dataverse data source and select the annotations table. 

    2. Retrieve Attachments:

      • Use the Filter() function to retrieve the attachments related to a specific record.

      • Example:
         
      • Filter(

          Annotations,
          objectid = ThisItem.Id // Replace ThisItem.Id with the ID of your record
      • )

      •  

    3. Display or Download Attachments:

      • Display Images: If the attachment is an image, you can use an Image control and set its Image property to:
         
      • "data:image/" & ThisItem.mimetype & ";base64," & ThisItem.documentbody

      • Download Files: For other file types (like .docx), you'll need to use a combination of techniques:

        • Convert the documentbody (base64) to a binary format.

        • Use a custom connector or a service like Azure Blob Storage to facilitate the download.

        • Alternatively, you can create a flow that is triggered from the powerapp, that will send the email with the attachment.
         

    4. Launch Function:

      • The Launch function can be used to launch a URL. This can be used in combination with a cloud flow to download the file.

      •  

    5.  

    Accessing Attachments in Power Automate:

    1. Dataverse Connector:

      • Use the Dataverse connector's "List rows" action to retrieve annotation records.

      • Filter the results based on the objectid and any other relevant criteria. 

    2. Get File Content:

      • Use the "Get a row by ID" (Dataverse) action to retrieve the specific annotation record.

      • The documentbody field will contain the base64-encoded file content. 

    3. Convert Base64 to Binary:

      • Use the base64ToBinary() expression to convert the documentbody value to binary. 

    4. File Operations:

      • Create a File: Use the appropriate connector (e.g., SharePoint, OneDrive, Azure Blob Storage) to create a file with the binary content.

      • Send an Email: Use the "Send an email (V2)" (Outlook 365) or similar action to send the file as an attachment.

      • Store in a Variable: You can store the binary content in a variable for further processing. 

      •  

    5.  

    Example Power Automate Flow:

    1. Trigger: (e.g., "When a row is added, modified or deleted")

    2. List Rows (Dataverse):

      • Entity Name: annotations

      • Filter Rows: objectid eq '<record GUID>' 

    3. Apply to Each:

      • For each annotation record:

        1. Get a row by ID (Dataverse):

          • Row ID: Annotation ID (from the "List rows" action_ 

        2. Compose:

          • Inputs: base64ToBinary(outputs('Get_a_row_by_ID')?['body/documentbody']) 

        3. Create File (SharePoint/OneDrive/Email attachment):

          • File Name: Annotation Subject (from the "Get a row by ID" action) + file extension.

          • File Content: Output from the "Compose" action.

          •  
           

    4.  

    Important Considerations:

    • Permissions: Ensure that the Power App user or Power Automate flow has the necessary permissions to access the annotation entity.
    • File Size Limits: Be mindful of file size limits in Power Apps and Power Automate
    • Performance: Retrieving and processing large attachments can impact performance.
    • Security: Handle attachment data securely, especially if it contains sensitive information.
    • File Extensions: When creating files, ensure you add the correct file extension based on the mimetype.

    •  

    By following these guidelines, you can successfully access and process attachment files from Dynamics 365 (Dataverse) in your Power Apps and Power Automate flows.

     
    If my answer was helpful, please click Like, and if it solved your problem, please mark it as verified to help other community members find more. If you have further questions, please feel free to contact me.
     
    My response was crafted with AI assistance and tailored to provide detailed and actionable guidance for your Microsoft Dynamics 365 query.
     
    Regards,
    Daivat Vartak
  • Jonas "Jones" Melgaard Profile Picture
    4,894 Super User 2025 Season 2 on at
    Access D365 Attachments Using PowerApp or Power Automate
    Hi Daivat,
     
    We don’t know the product in question, so your solution might be incorrect, like D365 F&O might not expose the attachment in all cases.
    My advice is that you should either inquire about product or adjust your ChatGPT prompt accordingly. Let me know if you need help.
     
    Again, Mohammed, what product are you using?
  • MohammedAfeef Profile Picture
    83 on at
    Access D365 Attachments Using PowerApp or Power Automate
    hello Jonas , it's D365 finance and operations,
  • Verified answer
    Jonas "Jones" Melgaard Profile Picture
    4,894 Super User 2025 Season 2 on at
    Access D365 Attachments Using PowerApp or Power Automate
    Thanks Mohammed (-:
    Unfortunately, there is no generic interface for attachments in F&O; rather, there are several area-specific entities for attachments, like CustomerAttachments or ReleasedProductDocumentAttachments.

    Scott Gaines made a really great video some time ago on how to do it:  https://www.youtube.com/watch?v=S26vsYaX-mg
     
    (I moved your question to the Finance forum, hope you don't mind)
  • MohammedAfeef Profile Picture
    83 on at
    Access D365 Attachments Using PowerApp or Power Automate
    thanks Jonas , I don’t mind at all

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.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 1,771

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 806 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 542 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans