Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Copilot Studio - General
Answered

virtual agent find user informaton from userid

(0) ShareShare
ReportReport
Posted on by 35

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?

  • Gianmaria85 Profile Picture
    35 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
    35 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
    31,728 Most Valuable Professional 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
    35 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
    35 on at
    Re: virtual agent find user informaton from userid

    sure

     

    1.jpg2.jpg

     

     

     

  • Expiscornovus Profile Picture
    31,728 Most Valuable Professional 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
    35 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
    31,728 Most Valuable Professional 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
    35 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
    31,728 Most Valuable Professional 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

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Copilot Studio - General

#1
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 74

#2
Pablo Roldan Profile Picture

Pablo Roldan 61

#3
stampcoin Profile Picture

stampcoin 10

Overall leaderboard