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 / Power Automate / Get User Details from ...
Power Automate
Unanswered

Get User Details from a "When a HTTP request is received" trigger

(0) ShareShare
ReportReport
Posted on by 6

I'm trying to update a Sharepoint list when a user clicks on a link. I want to pass a couple of items of data, which I've managed to do by passing them as parameters in the URL. I can't get the user's details though, even though they're logged in to their Microsoft accounts.

I've tried Get My Profile - but that's just my profile!

I've tried Get Users Profile but can't identify the user as the only dynamic content available are my parameters and "body". 

I've tried triggerOutputs()['header']['x-ms-user-email'] but it just says that doesn't exist.

 

Is there a way to get the id of the user who triggered the flow when you use the HTTP request trigger?

 

Thanks

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

    Hi @MrMacLeod,

     

    You can append a query parameter at the end of your HTTP Uri.

    &username=yourusername

     

    The whole Uri would be something like below (I obfuscated part of my example 😁)

    https://prod-30.yourregion.logic.azure.com:443/workflows/workflowguid/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=randomsig&username=yourusername

     

    With the flow you could identify that username property with the expression below:

    triggerOutputs()['queries']['username']

     

    You could for example use column formatting to include the username in the HTTP Uri with the '@me' special string value.

    This sample assumes you have the GET method enable in your When an HTTP request is received method btw.

     

    {
     "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
     "elmType": "a",
     "txtContent": "[$Title]",
     "attributes": {
     "target": "_blank",
     "href": "='https://prod-30.yourregion.logic.azure.com:443/workflows/workflowguid/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=randomsig&username=' + @me"
     }
    }

     

    triggerflowfromlink_withusername.png

     

  • MrMacLeod Profile Picture
    6 on at

    Hi @Expiscornovus Thanks for the reply and sorry for the delay in trying it out. First day back in the office!

     

    I'm a complete amateur with PowerAutomate so apologies if I'm just not getting something here.

     

    My Flow failed. I added &username=yourusername to the end of the URI but in the HTTP outputs it looks like it's only passed the string "yourusername" to the flow

     

    MrMacLeod_0-1672832870209.png

    so when I try to use 

    triggerOutputs()['queries']['username']

     to add the user to the list item, it doesn't work, because, I assume, there is no user called "yourusername".

     

    Have I misunderstood and were you saying I should actually include the user's username in the URI? If so that's not really what I need. I need the list to be updated with the username of which ever user happens to click the link.

     

    Also, when I use the column formatting with the @me string, it enters the name of the list item rather than the user's username.

     

    Thanks again for your time

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

    Hi @MrMacLeod,

     

    The column formatting steps are to retrieve the email address from whoever is logged on and is about to click the link. For every logged on user it should be a different link (after the "username=")

     

    That link is showing the title [$Title] as the display name. You can also use something different for the display name, like a static title "Trigger Flow with Username".

     

    {
     "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
     "elmType": "a",
     "txtContent": "Trigger Flow with UserName",
     "attributes": {
     "target": "_blank",
     "href": "='https://prod-30.yourregion.logic.azure.com:443/workflows/workflowguid/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=randomsig&username=' + @me"
     }
    }

     

    However, the href attribute (the link itself) should contain the email address of the logged on user who is about to click the link. That should be added at the end directly after the "username=".

     

    Can you double check if that part is working? (Use inspect in developer toolbar or copy/paste the url in notepad).

  • MrMacLeod Profile Picture
    6 on at

    Hi, it doesn't look like that is working properly. The href just links to .......&username=yourusername , it doesn't change to the logged on user's username.

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

    Hi @MrMacLeod,

     

    Can you share a screenshot of your formatted column? Just to double check your json code?

  • MrMacLeod Profile Picture
    6 on at

    Hi @Expiscornovus - I've been trying really hard with this and I think I've figured out why I'm not getting anywhere. My explanation of the problem was obviously pretty poor because we've ended up talking at cross purposes. I have a SharePoint site with videos and other resources on a number of pages. I want the user to be able to click a button or hyperlink on the page where the resource is after they've used it, which should then add an item to a list with details of the resource AND the user's username, to allow me to track who has used which resource. I can pass the details of the resource using the uri and add that to the list but I can't find a way to get the user's username.

     

    I understand now that you are showing me how to create a list item that would be able to do this, and now that I've got my head round that, your initial instructions were spot on. But if it's possible I would rather have it as just as a link or a button. Is there a way I can replicate that functionality with a button or link rather than than having to create a new list with a single item and add that to each page with a resource on it? btw thanks very much for helping.

     

     

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

    Hi @MrMacLeod,


    The reason why I was suggesting to use column formatting is because that technique has the '@me' special string value available.

     

    Within regular links and buttons that string value is not available and you would need to retrieve the current user name in a different way.

     

    That probably requires some coding or a custom web part. In the below link you see to examples of that:

    https://techcommunity.microsoft.com/t5/sharepoint-developer/get-current-user-details-sharepoint-online/m-p/3062981

     

  • anthonys123 Profile Picture
    483 on at

    Did you figure out a solution for this? I have a similar requirement - I just need to send an email to someone with the name / email of the person who clicked the button on a SharePoint Page.  So, this should just be a matter of getting the UPN of the user and passing that to Get User Profile (V2) in PowerAutomate.  

     

    It seems that by the end of this thread it was determined the posted suggestion is incorrect for a button on a page. 

  • MB-13091001-0 Profile Picture
    11 on at

    Hi everyone, is there anyone who has found a solution for this?

    I have the same issue...

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

    Hi @MariannaBucchi,

     

    I have created a blog about that first approach I shared within this thread. Maybe that is useful to get started?

    https://www.expiscornovus.com/2023/01/20/e-mail-me-button-on-page/

     

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!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 785

#2
Valantis Profile Picture

Valantis 669

#3
Haque Profile Picture

Haque 563

Last 30 days Overall leaderboard