Skip to main content

Notifications

Copilot Studio - General
Suggested answer

Handle attachment text

(1) ShareShare
ReportReport
Posted on by 2
Hi all,
 
I am trying to work on a simple chatbot for teams. The goal is to make a user be able to upload an attachment to teams and have a generative AI answer based on that document as a knowledge base.
However whenever i upload an attachment it is uploaded as a URL to a personal sharepoint which i can't access with the copilot.
 
The system.Activity.Attachment doesn't have the body text of the attachment either.
 
So my question is, how would i feed the content to the chatbot to answer based on a single attachment file?
Categories:
  • Suggested answer
    SaiRT14 Profile Picture
    SaiRT14 1,931 on at
    Handle attachment text
    I resolved the issue with the following steps:
    • User uploads a file in Teams.
    • Bot guides user to upload it to a shared SharePoint or Azure folder.
    • Power Automate detects the file, extracts the text, and sends it to the bot.
    • Bot references the extracted text as context for answering questions.
    More details:
     
    Instead of allowing users to upload files directly to the chat, configure the bot to guide users to upload files to a shared location accessible by the bot. For example, a dedicated SharePoint Document Library or a secure Azure Blob Storage container.
     
    Use Power Automate to detect when a new file is added to the shared location (e.g., a specific folder in SharePoint or Azure Blob Storage).
    use the AI Builder Text Recognition feature or built-in connectors to read the document’s content and extract text.
     
    let me know if you need help. Thanks
     
     
  • Suggested answer
    Vinoth Selvam Profile Picture
    Vinoth Selvam 1,278 on at
    Handle attachment text
     
    When i searched for some solution, i got the below details. Hope this can help you.
     
    The URL is generally accessible only to the user and may require additional permissions to be shared with the bot. To allow your bot to access the uploaded file, use Microsoft Graph API to set up file access permissions. When a user uploads a file, prompt them to allow the bot to access it. You could use Graph API’s sharing link capabilities to request a permission change.
     
    Use Graph API to download the file content directly, which will allow the bot to read the document's text and use it as a knowledge base. Once the file content is downloaded, use relevant file readers or parsers to extract the text.
     
    After parsing, the extracted text content can be fed to the chatbot’s generative AI model, which can now generate answers based on this document.
     
    Thanks.
     
     

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,567

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,907

Leaderboard