Skip to main content

Notifications

Power Platform Community / Forums / General / virtual agent find use...
General
Answered

virtual agent find user informaton from userid

Posted on by 22

hello everybody. i need some help.

I want to find person information (name/email) of my organization when i type to my bot the user id of this person.

how can i do?

Categories:
  • Gianmaria85 Profile Picture
    Gianmaria85 22 on at
    Re: virtual agent find user informaton from userid

    Ok the second problem was that i was writing in the variable 'send_an_HTTP_request' but the program was set in italian lenguages.

    Thank you Expiscornovus for the help anche patience! 

  • Gianmaria85 Profile Picture
    Gianmaria85 22 on at
    Re: virtual agent find user informaton from userid

    i'm a stupid, you are perfectly right were the spaces that generated the error!!now i have another problem with the following variable this is the error that generates me:

    please correct to include a valid reference to 'send_an_http_request' for action imput parameters. 'set veriable'

     

     

  • Expiscornovus Profile Picture
    Expiscornovus 1,637 on at
    Re: virtual agent find user informaton from userid

    Hi @Gianmaria85,

     

    That is exactly what I suggested 😉

     

    Only difference is the beta endpoint instead of v1.0 one and I escaped the ? character with a slash.

     

    Btw, in your previous screenshot it looked like the Uri value ended with a lot of unnecessary space characters. That might be the reason it did not work.

  • Gianmaria85 Profile Picture
    Gianmaria85 22 on at
    Re: virtual agent find user informaton from userid

    i think i found the solution....in graph explorer i create a request like this:

    https://graph.microsoft.com/beta/users/?$filter=onPremisesSamAccountName eq '(badge)'&$count=true

    and the system return all the user information to me!!!now i try to insert it into the flow

  • Gianmaria85 Profile Picture
    Gianmaria85 22 on at
    Re: virtual agent find user informaton from userid

    sure

     

    1.jpg2.jpg

     

     

     

  • Expiscornovus Profile Picture
    Expiscornovus 1,637 on at
    Re: virtual agent find user informaton from userid

    Hi @Gianmaria85,

     

    Can you share a screenshot of your current configuration/flow setup?

  • Gianmaria85 Profile Picture
    Gianmaria85 22 on at
    Re: virtual agent find user informaton from userid

    Sorry, in the search field the office 365 group he didn't let me find it.

    Anyway, i corrected the flow but it gives me this error:

     

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
    <HTML><HEAD><TITLE>Bad Request</TITLE>
    <META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
    <BODY><h2>Bad Request - Invalid Hostname</h2>
    <hr><p>HTTP Error 400. The request hostname is invalid.</p>
    </BODY></HTML>

  • Expiscornovus Profile Picture
    Expiscornovus 1,637 on at
    Re: virtual agent find user informaton from userid

    Hi @Gianmaria85,

     

    1. There are different Send an HTTP request actions. Can you double check you the same connector and action like in my example? 

     

    o365groups.png

    2. Did you also add the 'ConsistencyLevel: eventual' header in the CustomHeader1 field?

     

    header_level.png

  • Gianmaria85 Profile Picture
    Gianmaria85 22 on at
    Re: virtual agent find user informaton from userid

    the send http request return an error when i use the flow:

    {
      "error": {
        "code"400,
        "message""URI path is not a valid Graph endpoint, path is neither absolute nor relative or resource/object is not supported for this connector. Resources: me,users Objects: messages,mailFolders,events,calendar,calendars,outlook,inferenceClassification. Uri: https://graph.microsoft.com/v1.0/users/?$filter=onPremisesSamAccountName eq 'i219366'&$count=true",
        "source""flow-apim-europe-001-westeurope-01.azure-apim.net",
        "path""choose[6]\\when[1]",
        "policyId""",
        "clientRequestId""6866ebf6-9d32-48b8-ae5c-de98accbba3f"
      }
  • Verified answer
    Expiscornovus Profile Picture
    Expiscornovus 1,637 on at
    Re: virtual agent find user informaton from userid

    Hi @Gianmaria85,

     

    I think you can use a List users method of the Graph API for the search in instead. Use a $filter query parameter on onPremisesSamAccountName which you are using to store the badge number. 

     

    Below is an example

     

    1. In the Send an HTTP request action (Office 365 Groups connector) use the following URI

    https://graph.microsoft.com/v1.0/users/?$filter=onPremisesSamAccountName eq '@{triggerBody()['text']}'&$count=true

     

    Also make sure you add the ConsistencyLevel: eventual header as well.

     

    2. In the condition check if the length of the response is greater than 0. This means it has found users.

     

    length(body('Send_an_HTTP_request')['value'])

     

    3. In the set variable use the expression below to retrieve the displayName and mail of the first user match

    first(body('Send_an_HTTP_request')['value'])['displayName']
    first(body('Send_an_HTTP_request')['value'])['mail']

     

     

    onpremisessamaccountname_filter.png

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,637