Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Copilot Studio - General
Answered

How can i leverage the System.Activity.Attachments Variable

(2) ShareShare
ReportReport
Posted on by 6
Hi !
 
We are testing the in chat attachment feature and i have a hard time dealing with the System.Activity. Attachments variable. I tried to use it many different way and i get consistent errors. I sent i to a "create prompt" action inside a topic, tried to use the one drive connector and also HTTP request to powerautomate but i never was able to get it properly working.
 
Could you tell me how this variable was intended to use and also if there is a better way to leverage the in chat attachment feature to be able to answer users based on the attachments provided by them in real time.
 
Thank you !
Categories:
  • FJ-12021647-0 Profile Picture
    6 on at
    How can i leverage the System.Activity.Attachments Variable
    Thank you guys !
  • Verified answer
    CU26051310-2 Profile Picture
    28 on at
    How can i leverage the System.Activity.Attachments Variable
    Now there are more easy way :)

    Attachments is a table. Everything is about knowing how to write formula for a table. if not you could use "first()" function to get the first attachment (often there is only one)

    in preview we have the "loop" componnent to make "loop" on all the attachment : the real way to work with a table of attachment :)
     
    a preview feature about "reading image" is possible to be activated in you r agent now :)
     
    if you cannot wait for all the preview you have to the hard way  and use AI like Azure Vision or AI Builder.
     
    BUT : just look closer at the home page of you agent creation :) you have the "document processing agent" in coming soon preview; ) what is the idea behind that ?
    Soon you will have the "multi agent" option : so you will use multi agent with a prompt to catch the attachment, analyse it and send back info to you without code :)

    sorry to not give an easy immediat answer, just a wait :) 
     
    if it help, please check the answer is the good one, it's important :)
     
  • Verified answer
    Inogic Profile Picture
    1,023 Super User 2025 Season 1 on at
    How can i leverage the System.Activity.Attachments Variable
    Hi,
     
    System.Activity.Attachments is a read-only variable in PVA that stores the attachments a user sends during a conversation. This variable holds an array of objects, where each object contains metadata about an attachment (like the content URL, content type, name, etc.). However, you cannot directly access the file content in PVA itself — you typically need to send it to Power Automate or some other service to process it.


    What Doesn't Work
    1. Sending System.Activity.Attachments directly to Power Automate
      Doesn't work well because it's an array and the values inside may not serialize cleanly.
    2. Using it in a "Create Prompt" node
      Not effective, because prompts expect simple types (text, number, etc.), not file metadata.
    3. Trying to process the attachment directly in PVA
      Not possible — PVA cannot fetch or parse the actual file; it only captures the metadata.
    Recommended Approach
    1. Send System.Activity.Attachments to Power Automate
    • Trigger: Use the "Call an action" step in PVA and connect to a Power Automate flow.
    • Input: Pass the attachment object(s) as JSON text.

    2. Power Automate - Flow Design

    In the Power Automate flow:
    1. Trigger: PVA → "When a Power Virtual Agents flow is called"
    2. Parse JSON: Add a Parse JSON step to parse the attachments input.
    3. Use HTTP Action (if needed): If you want to read the file, you’ll likely need to:
    • Add HTTP with Azure AD to fetch the file (if authenticated)
    • Or directly call the contentUrl (if anonymous/short-lived token is okay)
    1.  Store or Process File:
    • Use OneDrive/SharePoint/Blob to store it
    • Or use AI Builder / Cognitive Services to extract data
    1. Respond back to PVA with results (like extracted data, confirmation, etc.)
    Hope this helps.
     
    Thanks!
    Inogic

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >