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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Copilot Studio / virtual agent find use...
Copilot Studio
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?

Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,784 Most Valuable Professional on at

    Hi @Gianmaria85,

     

    You could use a flow for this. In that flow you can use the get user profile (v2) action to try and find the user based on userid.

     

    Below is an example setup

     

    1. The cloud flow setup.

    In this setup I have configured the configure run after setting of the condition action. It also runs when it has failed. This is to make sure we can output the No user found in the If No branche.

     

    flow_finduser.png

     

    2. The PVA topic which uses that flow and show the output in a message to the user interacting with the bot.

     

    finduser_topic_pva.png

  • Gianmaria85 Profile Picture
    35 on at

    I'm sorry if i only answer now... I try but the flow generate the error user not found. i am attaching the screenshot of the error. In microsoft list i can find a user's data starting from the userid, here no.. Any suggestions?

     

     

    help.jpg

  • Expiscornovus Profile Picture
    33,784 Most Valuable Professional on at

    Hi @Gianmaria85,

     

    A Get user profile (v2) action expects a user principal name or a user id. Although you blurred that value in the screenshot it does not look it is either a UPN or user id value. Can you double check that?

     

    It looks like you are searching with something else, what did you use. The samAccountName or the displayname of a user?

     

    In your opening post you mentioned that you wanted to use the user id of the user. So, could you clarify what you actually want use to search?

  • Gianmaria85 Profile Picture
    35 on at

    Hi Expiscornovus,

    thank you for your patience. I'm using the badge number ixxxxxx becouse in microsoft list this number can find the user associated.

    So i need to find a way to get the userid by putting the number of badges as imput. i don't understend how microsoft list can find the users with the badge number.

  • Gianmaria85 Profile Picture
    35 on at

    i just checked and even in microsoft teams i can search users with the badge number...

  • Expiscornovus Profile Picture
    33,784 Most Valuable Professional on at

    Hi @Gianmaria85,

     

    The approach I suggested was based on the requirement that you wanted to use the user id.

     

    I simply need to re-design the flow, because you want to use the badge column instead. The flow I shared earlier will not work with this other field. It will always output user not found.

     

    Just to double check, which field in Azure Active Directory/User profile have you used to store the badge number?

  • Gianmaria85 Profile Picture
    35 on at

    i don't sure that i undurstand what do you want...if i go in azure/user profile the badge numbers is in three field.

    i attach the screenshot where i obscured the data not knowing which ones are sensitive to the company where i work.field.jpg

  • Expiscornovus Profile Picture
    33,784 Most Valuable Professional on at

    Hi @Gianmaria85,

     

    Thanks for sharing, that is really useful 👍

     

    To clarify, searching and finding people via a people picker in a SharePoint Online list/library column works different compared to retrieving that same profile information in a flow.

     

    So, unfortunately your request is not as straightforward as it looks in the SharePoint list.

     

    That's why I am trying to find the correct approach for the information you are trying to retrieve via the Power Virtual Agent and the connected cloud flow. Hopefully that makes sense?

  • Verified answer
    Expiscornovus Profile Picture
    33,784 Most Valuable Professional on at

    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

  • Gianmaria85 Profile Picture
    35 on at

    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"
      }

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Copilot Studio

#1
Valantis Profile Picture

Valantis 410

#2
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 160 Super User 2026 Season 1

#3
chiaraalina Profile Picture

chiaraalina 63 Super User 2026 Season 1

Last 30 days Overall leaderboard