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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Copilot Studio / Integrating Copilot St...
Copilot Studio
Suggested Answer

Integrating Copilot Studio with User's Data

(2) ShareShare
ReportReport
Posted on by 6
Hello everyone,
 
I'm looking to create a custom Copilot agent that can access and interact with the OneDrive and mailbox of the user that is chatting with the agent. 
The idea is to have the custom Copilot agent provide answers and assistance based on the user’s personal data, rather than relying on hardcoded knowledge.
 
 
I did find how to add knowledge to a Copilot Agent, however this always seems to be a static uploaded document, documents from a hardcoded SharePoint site, information from a hardcoded public website, etc. 
How can I make my copilot agent interact with the user's data that is chatting with my copilot agent, similar to what the native Copilot agent in Teams does? 
 
Looking forward to your thoughts and suggestions!
Categories:
I have the same question (0)
  • Suggested answer
    Vinoth Selvam Profile Picture
    1,590 Super User 2025 Season 2 on at
     
    Creating a custom Copilot agent that can access and interact with a user's OneDrive and mailbox requires integrating Microsoft Graph API and handling OAuth2 authentication to access and manipulate the user’s personal data securely.

    The Microsoft Graph API allows developers to interact with various Microsoft 365 services, including OneDrive, Outlook (mailbox), Calendar, Teams, and more. Through Graph API, your Copilot agent can access:

    • OneDrive files: List, search, read, or update the files in a user’s OneDrive.
    • Mailbox data: Read emails, send emails, or filter based on criteria.

    You need to configure the proper OAuth2 permissions in Azure Active Directory (Azure AD) for your custom Copilot agent to access personal data. The main steps are:

    • Register the application in Azure AD.
    • Set up delegated permissions for accessing user data:
      • For OneDrive: Files.Read, Files.ReadWrite, or Files.Read.All
      • For Mailbox: Mail.Read, Mail.Send, or Mail.ReadWrite
    Let us trust, Copilot is evolving drastically and Improving day by day. Much more to come to help us :)
     
    Thanks.
  • CU18101635-0 Profile Picture
    6 on at
    Thanks for the reply!
     
    I understand I need to integrate with Ms Graph under delegated permissions of the user, however I have trouble finding in Copilot Studio where I can add the MS Graph connection? 
    I expected it to be part of a knowledge connector, but it doesn’t seem visible there. Where should I be able to find the possibility in Copilot Studio to add MS Graph?
  • RR-27011928-0 Profile Picture
    7 on at
    Follow-up question...Let's say we successfully call the Graph API to read perhaps the "search my OneDrive" api:https://graph.microsoft.com/v1.0/me/drive/root/search(q='...search-text...')?select=name,id,webUrl
     
    I would get back a json string array with file info, e.g. name, id, and webUrl based on the call above.  Then what?  How would I connect the results of the api call to the processing of the prompt?  When the Copilot successfully interrogates a hard-coded Sharepoint site, the resulting matching documents are passed to the Generative AI LLM automatically and you get back an answer.  
     
    However, when we introduce the step of manually calling Graph API, I'm having a hard time connecting the dots between those results and the Generative AI processing.  Thanks for any insights.
  • Suggested answer
    RR-27011928-0 Profile Picture
    7 on at
    Part of the puzzle for me has been solved and I'll share here in case it helps.  In order to target a user's OneDrive data you can "Add SharePoint Knowledge source" and point to https://[your tenant domain]-my.sharepoint.com.  Then, you have to require the user to sign in and use the Azure Active Directory v2 service Provider.  The authentication will be routed through a "Registered application" on your azure portal that has the proper permissions ('Files.Read.All profile openid Sites.Read.All') granted along with a client id (application id) and secret.  I hope this helps others.  I'm not yet to the point of accessing mail data, but I have found that no graph api calls (directly and manually added by you as the Agent author) are necessary for OneDrive access.
  • AllanMouraDev Profile Picture
    142 Super User 2025 Season 2 on at
    I would suggest you to try the classic approach.

    Build the conversation path, creating menus and topics that the user can interact and gather information. Whenever the user goes to a topic that need a specific info, return that using a Power Automate Flow, you can also use ai builder to add AI intelligence to manage the data and act as you want (prompts for example).

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Copilot Studio

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 279 Super User 2025 Season 2

#2
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 200 Super User 2025 Season 2

#3
S-Venkadesh Profile Picture

S-Venkadesh 94 Moderator

Last 30 days Overall leaderboard