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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / URI syntax when using ...
Power Automate
Unanswered

URI syntax when using Send HTTP Request to SP (PeopleManager/GetPropertiesFor)

(0) ShareShare
ReportReport
Posted on by 716 Moderator
For the life of me I cannot figure out what the designer wants in the uri field when using the Send HTTP Request to Sharepoint action.
 
The trigger receives just two values from the app call. 
_api/SP.UserProfiles/PeopleManager/GetUserProfilePropertyFor(accountName=@v,propertyName='sktlCostCenter')@v='i:0#.f|membership|triggerBody()['text']'
Results in an Expression invalid when I try saving. I thought maybe it's because it didn't like the unencoded url, so I tried this:
_api/SP.UserProfiles/PeopleManager/GetUserProfilePropertyFor(accountName=@v,propertyName='sktlCostCenter')@v=%27i%3A0%23.f%7Cmembership%7CtriggerBody()['text']'
And when that didn't work, I tried to wrap the original attempt in encodeURI:
_api/SP.UserProfiles/PeopleManager/GetUserProfilePropertyFor(accountName=@v,propertyName='sktlCostCenter')@v='"+encodeUriComponent('i:0#.f|membership|triggerBody()['text']')+"'
So now I'm at a loss.
Categories:
I have the same question (0)
  • David_MA Profile Picture
    12,966 Super User 2025 Season 2 on at
    I am not exactly sure I understand what you are trying to do? Are you trying to get the manager for someone? If so, there is a much easier way to do this in Power Automate than sending an HTTP request. Use the Get manager action and populate it with the e-mail of the person you are trying to get the manager for:
     
    A more challenging way would be to make a call to the Graph API with this call: https://graph.microsoft.com/v1.0/users/first.last@domain.com?$expand=manager. You can get information on Graph API calls at Graph Explorer | Try Microsoft Graph APIs - Microsoft Graph
     
     
  • DCHammer Profile Picture
    716 Moderator on at
    I'm trying to get a custom property. You can't use the regular Get actions because they don't know anything about the custom properties on a user. I'm trying to find a cost center value in the same way someone might want to look up an employee ID or something.
     
    You use the Send an HTTP Request to Sharepoint.
    What is not in front of the _api is the site address. You can use any SP site that you have appropriate rights for.
     
    I might in fact have a rights issue but the Expression dialog doesn't know anything about that yet and should let me save a value URI into the field but doesn't. I seem to have a syntax problem somewhere because even if I put that into a browser like below it tells me that the Expression is Invalid.
     
    https://a.replacewithareal.spsite/_api/sp.userprofiles/peoplemanager/GetUserProfilePropertyFor(AccountName=@v,propertyName='sktlCostCenter')@v=%27i%3A0%23.f%7Cmembership%7Csomeone@somewhere.com%27
  • David_MA Profile Picture
    12,966 Super User 2025 Season 2 on at
    You can use the Graph API request to get the custom properties as well. The Graph API call would be https://graph.microsoft.com/v1.0/users/first.last@domain.com?$expand=manager&$select=displayName,mail,customProperty1,customProperty2 and replace customProperty1 and customProperty2 with the appropriate values.
  • DCHammer Profile Picture
    716 Moderator on at
    @David_MA I get an Access token is empty error when I put that into a browser. Do I have to call my IT department to get some rights adjusted?
  • David_MA Profile Picture
    12,966 Super User 2025 Season 2 on at
    Here is an example of using the Graph API call to get the manager information:
     
    To generate the scheme, just create your flow to the point of sending the Graph API call and then put the body of it into a Compose action. Run your flow and copy what is returned in the compose action. You can then use the Generate from sample feature to generate the scheme. Note, you'll need to review the flow run with the old designer as I don't see that the new designer returns it the same way.
     
    Then to access the manager data, you would use expressions to get the data returned. They don't show as expressions in the screen shot but as values from the Parse JSON action, but they are not actually returned unless you use an expression. This is the expression to return the display name of the manager: body('Parse_JSON')?['manager']['displayName']

    We store cost center information in the department field, which would just use this expression from the data already returned by expanding the manager information: body('Parse_JSON')?['manager']['department']
  • Verified answer
    David_MA Profile Picture
    12,966 Super User 2025 Season 2 on at
    Re: @David_MA I get an Access token is empty error when I put that into a browser. Do I have to call my IT department to get some rights adjusted? It has been so long since I had access, I forget. First though, make sure the HTTP action looks the same as the one I used. You want the one from here:
    I do remember I needed to get read access in Entra ID, which was handled by a request to our IT department. You can go to https://portal.azure.com/ and then search for an e-mail address in the search bar. If it returns results and you do not get an error, you should have the correct permissions. If you get an error, then that is probably the cause of your issue.
  • DCHammer Profile Picture
    716 Moderator on at
    @David_MA Thank you very much. The Azure test revealed I have an access issue. It would appear that I can get back any of the standard properties for a user but a search for the custom properties returns nothing using that 0365 HTTP Request.
    If I take out the custom properties, it works perfectly.
     
    This was a lot of troubleshooting thinking I had a syntax problem. Learn something new every day.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard