Hi Nha Tran Huu,
You're correct that Microsoft has deprecated the System.Activity.ChannelData.OriginalAttachments
structure. Here's the current approach to handle file uploads in Copilot Studio:
Solution: Using the File Variable Type
- Configure File Upload in Your Topic
In your topic, when you receive a user message with a file:
- The system should automatically detect the file upload
- Use the "Save user response as" option and select File as the variable type
- Access File Properties
Once you have the file stored in a variable (e.g., VarFile
), you can access:
- File name:
VarFile.name
- File content URL:
VarFile.contentUrl
- File size:
VarFile.size
- File type:
VarFile.contentType
- Pass to Power Automate
In your Power Automate flow:
Add inputs for the file data:
- Add a text input for the file name
- Add a text input for the content URL
- Pass `VarFile.name` to the file name input - Pass `VarFile.contentUrl` to the content URL input
- In Power Automate, retrieve the file content: HTTP Action: - Method: GET - URI: {contentUrl from input} - Authentication: Use appropriate auth based on your environment
Alternative: Direct File Handling in Power Automate
If the above doesn't work, try this approach:
In Copilot Studio, pass the entire activity context to Power Automate
In Power Automate, parse the activity JSON:{ "attachments": [ { "contentType": "application/octet-stream", "contentUrl": "https://...", "name": "filename.txt" } ]}
Important Notes:
- Ensure your Copilot Studio environment is updated to the latest version
- The File variable type should automatically capture uploads
- If files aren't being detected, check your channel configuration (Teams, Web Chat, etc.)
If you're still having issues, please share:
- Which channel you're using (Teams, Web Chat, etc.)
- The exact error or behavior you're seeing
- A screenshot of your topic configuration
Hope this helps!
Thanks,
Karan Shewale.
*************************************************************************
If the response is helpful, please click "Accept Answer" and upvote it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.