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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Copilot Studio / Agent with OneDrive as...
Copilot Studio
Answered

Agent with OneDrive as knowledge source - difficulties to get it to working

(2) ShareShare
ReportReport
Posted on by 10
Hello everyone,
 
I'm currently working on building a studio agent to perform the following process steps:
 
1. Read all files stored in a specified OneDrive folder
2. Fill in a JSON code template based on information in these files
 
I have attempted adding OneDrive as Knowledge Source in my agent but I cannot get it to working. The agent asks for the ID of my folder, which I provide only to get back this error:
 
Error Message: The connector 'OneDrive for Business' returned an HTTP error with code 400. Inner Error: Invalid fileId Error Code: ConnectorRequestFailure Conversation Id: 3609ded0-8f28-47c2-ac92-bfa767d57ea6 Time (UTC): 2026-08-10T13:25:24.310Z
 
I would really appreciate any help with that.
 
If I may add, I have previously attempted other approaches to my requirement including using Copilot chat and/or using Power Automate and/or using a Copilot Studio agent in a different way (e.g. adding Skills). One thing I noticed is that when Copilot processes OneDrive folders, what it actually does is first performing a search on files, then working on the files returned by the search (i.e. it struggles to go directly to the folder and start working on the files there). I would really appreciate if your recommendation ensures that the Copilot Studio agent developed will NOT perform a search on OneDrive but rather simply work on the specified folder.
 
Many thanks in advance.
 
I have the same question (1)
  • Verified answer
    Dua Sadiq Profile Picture
    106 on at

    Hi, based on your requirement, I would recommend Agent Flow rather than using the OneDrive Knowledge Source.

    The key distinction is that your requirement is deterministic file processing, rather than semantic retrieval. You want the agent to:

    1. Go to a specific OneDrive folder.
    2. Retrieve the files in that folder.
    3. Process each file.
    4. Extract the required information.
    5. Populate a predefined JSON structure.
     

    A Copilot Studio Knowledge Source is primarily designed for search and retrieval based on indexed content. It is therefore not the ideal mechanism when you need to guarantee that every file in a particular folder is processed.

    Recommended architecture (See Attachments as well)

    Use Copilot Studio → Agent Flow → OneDrive for Business → AI Builder → Copilot Studio.

    The flow could be structured as follows:

    1. List files in folder – OneDrive for Business

    Configure the action with the specific OneDrive folder you want to process. This gives the flow an explicit folder as its starting point rather than asking OneDrive to perform a broad content search.

    2. Apply to each

    Loop through the files returned by the previous action.

    3. Get file content – OneDrive for Business

    Use the file identifier from the current iteration to retrieve the actual file content.

    4. Run an AI Builder prompt

    Pass the file content to an AI Builder prompt configured to extract the required information and populate your predefined JSON schema.

    You can also instruct the prompt to return only valid JSON matching your required structure.

    5. Return the result to Copilot Studio

    The flow can return the generated JSON to the agent, where it can be displayed, stored, or passed to another process.

    One additional consideration: if the folder can contain different file types (Word, PDF, Excel, images, etc.), the extraction step may need to be adapted depending on the type of content being processed.

     

    Screenshot - 2026-08-11T002528.089.png
    Screenshot - 2026-08-11T002613.593.png
  • AD-10081327-0 Profile Picture
    10 on at
    Hi @Dua Sadiq - it's really helpful reading through your reply so many thanks for this.
     
    I still have some concerns though I was wondering if you could help with. Main one being that I haven't been able to find a way to process PDF files in Power Automate without using a premium connector (that I currently do not have access to). And I have similarly struggled with processing Word files that include image files inside.
     
    Also, while this process is relatively deterministic, the requirement is different every time in the sense that it might be a different folder that needs to be process.
     
    One more thing, the solution will need to ensure all sub-folders within the root folder will also be included in the processing.
     
    Are you still confident in your proposed architecture to be a good fit for this use case? If so, I would really appreciate if you'd be able to give some advice (or specific instructions) on how to achieve the processing for PDF and Word files as explained above.
     
    Many thanks in advance once more.
     
    Antonis
  • Verified answer
    Dua Sadiq Profile Picture
    106 on at

    Hi Antonis,

    Yes, having looked at the additional requirements, I’m still confident that the Agent Flow approach I originally suggested is a good fit.

    The main reason is that the process itself is quite deterministic: you provide a root folder, the flow discovers the files underneath it (including nested subfolders), processes each file, and returns the structured results. Agent Flows are particularly well suited to this type of deterministic business-process automation and provide the looping/control structures needed for the folder traversal.

    I’ve used a similar approach for recursively discovering and processing files in SharePoint, and the same pattern can be applied to OneDrive. The root folder can be supplied dynamically, so it doesn't need to be hardcoded.

    For PDFs, the file can be passed into the AI processing/prompt stage for analysis, including PDFs containing visual content. For Word documents with embedded images, I would add an intermediate step to convert the Word document to PDF and then process the resulting PDF, rather than trying to pass the DOCX directly to the Prompt.

    One important distinction, though: when I refer to this architecture, I’m specifically talking about Copilot Studio Agent Flows, not a conventional Power Automate cloud flow. Agent Flows have their own Copilot Studio consumption model, so this may also address the Premium-connector concern you mentioned.

    So at a high level, I would see it as:

    Dynamic root folder → recursive folder/file discovery → file-specific processing → AI extraction → structured results

    I think this is still a good architecture for the use case you described.

  • AD-10081327-0 Profile Picture
    10 on at
    Thank you very much @Dua Sadiq for your response once again.
     
    I have now started working on building the agent flow to progress with this task. I'm sure my current draft still needs a lot of fine tuning to be successfully running, however one major blocker at the moment is that I'm not able to see in the Agent Flow designer your "File Analysis" step (last screenshot in your initial post). In fact, I do not see 'AI builder' or 'Run AI prompt' or anything similar when inserting a new step in my flow. I'm able to see these set of actions in make.powerautomate flows, but not in Copilot studio agent flows.
     
    Any thoughts on that?
     
    Thanks,
    Antonis
  • Dua Sadiq Profile Picture
    106 on at

    Hi Antonis,

    Before anything else  when you click Add a new action in your agent flow, can you see the AI capabilities section at all, or is it completely missing? Could you share a screenshot of your action picker? That will help narrow this down quickly.

    If the entire AI capabilities section is missing, it's most likely an environment setting. Ask your admin to check Power Platform Admin Center → Manage → Environments → [your environment] → Settings → Features and look for the AI prompts toggle  make sure it's turned On. (see screenshot)


     

    On the "File Analysis" step  that's just a custom prompt I created and named it that, it's not a built-in action. You can create your own the same way: click Add a new action → AI capabilities → Run a prompt, then either pick an existing prompt or create a new one inline. You can also build prompts separately via Tools in Copilot Studio and they'll show up in the picker when you add the action.

    Hope that 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.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Copilot Studio

#1
Dua Sadiq Profile Picture

Dua Sadiq 104

#2
11manish Profile Picture

11manish 87 Super User 2026 Season 2

#3
sannavajjala87 Profile Picture

sannavajjala87 84 Super User 2026 Season 2

Last 30 days Overall leaderboard