Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Copilot Studio - Calling Actions from Copilot S...
Answered

Calling the Graph API to do a document search in PVA

(3) ShareShare
ReportReport
Posted on by

In the below example, I'm going to show how to do a document search on documents stored in a specific SharePoint site, from a Power Virtual Agents chatbot, using Power Automate and the Microsoft Graph API.

 

Here's the end result (using the new native chatbot component in Power Apps ✨😞

 

HenryJammes_0-1680916387986.png

 

  • JuliL Profile Picture
    36 on at
    Re: Calling the Graph API to do a document search in PVA

    Thank you @HenryJammes ! I was successful until "Parse Json" the output is fine, my problem is after that. I tried calling rank for example but it shows null even though it shows a value in Parse Json, so my problem is when I try to extract the information from the json. I am working with Sharepoint Lists.

    Output from Parse Json

    julilis_0-1707874246821.png

     

     

    Value output - [

    @{outputs('Parse_JSON')?['body']?['value']

    ]


    julilis_1-1707874285303.png

     

     

    Do you have any idea of what is going on?

     

    Thanks,

    Juli

  • Lefty Profile Picture
    1,623 on at
    Re: Calling the Graph API to do a document search in PVA

    Hi @HenryJammes 

    Do you know if i can search for a keyword inside documents, inside a SharePoint document library, and provide the number of occurrences the searched word appears in each document? 

  • CydmanSG Profile Picture
    10 on at
    Re: Calling the Graph API to do a document search in PVA

    Thanks for answer my post here and I am able to get the document from SharePoint. But the solution are not based like what HenryJammes posted here. thank you team

  • Community Power Platform Member Profile Picture
    on at
    Re: Calling the Graph API to do a document search in PVA

    Hello @HenryJammes, thanks a lot for your tutorial. I implemented it but the graph api always returns 0 results after searching. I do have doucments in my sharepoint. I would like to know if i have to create a specific sharepoint site or just put documents in my sharepoint no matter what site is.  

  • remidyon Profile Picture
    on at
    Re: Calling the Graph API to do a document search in PVA

    Nope. Sharepoint & OneDrive both require authentication 

  • wswitzerLM Profile Picture
    8 on at
    Re: Calling the Graph API to do a document search in PVA

    Is there any way to use sharepoint or OneDrive document content for a public facing bot where authentication isn't based on a the signed-in user?

  • CydmanSG Profile Picture
    10 on at
    Re: Calling the Graph API to do a document search in PVA

    Hi @HenryJammes thank you for your message. That's the first thing I did before trying your solution here. It didn't give me the correct document and link, sometimes it gave multiple results but the same documents.

  • HenryJammes Profile Picture
    on at
    Re: Calling the Graph API to do a document search in PVA

    I'm not sure what is wrong with your cloud flow, but I guess you have an error in there.

    In any case, why not use Generative Answers in Copilot Studio, as it has a SharePoint data source? 

    Generative answers - Microsoft Copilot Studio | Microsoft Learn

    Use content on SharePoint or OneDrive for Business for generative answers - Microsoft Copilot Studio | Microsoft Learn

  • CydmanSG Profile Picture
    10 on at
    Re: Calling the Graph API to do a document search in PVA

    Hi @HenryJammes 

    Thank you for this guide, I am looking for this kind of concept and I tried to mimic your configuration here but for some reason I have this error. It says, "Request to XRM API failed with error: 'Message: Flow client error returned with status code "BadRequest" and details "{"error":{"code":"InvalidFlow","message":"The template validation failed: 'The repetition action(s) 'Apply_to_each:_hitsContainer' referenced by 'inputs' in action 'Append_to_string_variable' are not defined in the template.'."}}". Code: 0x80060467 InnerError: '."

     

    I am new users of PVA with Power Automate. My goal is to search a document to my Sharepoint Site when a user key in a key word to my bot. Hope you can give your inputs where to check this error. Thank you very much.

    CydmanSG_0-1700757701110.png

     

  • HenryJammes Profile Picture
    on at
    Re: Calling the Graph API to do a document search in PVA

    Hi @SCP-Tobs 

     

    Yes. During preview Generative Answers is only available in the US region. 

    For full document indexing / searching, I would suggest to have a look at Azure Cognitive Search and Azure OpenAI on your data. 

    This thread is about integrating them in a custom way in PVA: 

    https://powerusers.microsoft.com/t5/Power-Platform-Integrations/Integrate-a-PVA-chatbot-with-Azure-OpenAI-using-your-data-TBD/td-p/2233900

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 >

Featured topics