Skip to main content

Notifications

Calling Actions from Copilot Studio
Answered

Calling the Graph API to do a document search in PVA

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
    JuliL 2 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
    Lefty 2 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
    CydmanSG 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

  • 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
    remidyon on at
    Re: Calling the Graph API to do a document search in PVA

    Nope. Sharepoint & OneDrive both require authentication 

  • wswitzerLM Profile Picture
    wswitzerLM 6 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
    CydmanSG 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
    HenryJammes 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
    CydmanSG 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
    HenryJammes 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

Helpful resources

Quick Links

Exciting News for Copilot Studio Communi…

Get ready to experience a whole new level of engagement with the Copilot Studio…

Celebrating the May Super User of the…

LaurensM is an exceptional contributor to the Power Platform Community…

Check out the Copilot Studio Cookbook…

We are excited to announce our new Copilot Cookbook Gallery in the Community…

Leaderboard

#1
renatoromao Profile Picture

renatoromao 6,459

#2
Pstork1 Profile Picture

Pstork1 1,954

#3
Expiscornovus Profile Picture

Expiscornovus 1,667

Featured topics