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 Apps / Dynamic URL in custom ...
Power Apps
Answered

Dynamic URL in custom connector to query graph api

(0) ShareShare
ReportReport
Posted on by 90

I want to create a power app that displays all groups for a user.

The username will be entered into a text box and graph url will be constructed.


The graph URL is:

 

https://graph.microsoft.com/v1.0/users/{User ID}/memberOF?$select=displayName

 

Note the user id, which varies depending on the user being queried.

The custom connector to graph does not appear to allow a dynamic url.


How can i get around this in powerapps?

Do i need to avoid a custom connector altogether and instead use an azure function?

Categories:
  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @winston_smyth ,

    Could you please share a bit more about your scenario?

    Do you want to construct your custom connector URL Path dynamically?

     

    Based on the scenario that you mentioned, I suppose that you want to make the {User ID} as dynamic value against the user name you typed within a Text Input Box, right?

     

    If you want to make the {User ID} as dynamic value against the user name you typed within a Text Input Box, I afraid that there is no way to achieve your needs in custom connector of PowerApps currently.

     

    As an alternative solution, I think the combination of Office 365 Users connection and your custom connector could achieve your needs. On your side, you just need to specify the action path within your custom connector based on the Graph URL that you mentioned.

     

    Then within your app, add a connection to your custom connector and Office 365 Users connector. Add a Text Input box to collect user name entry.

    5.JPG

     

    6.JPG

    Set the OnSelect property of the "Retrieve" button to following:

    ClearCollect(
     GroupsCollection, 
     PowerAppsMicrosoftGraph.ListGroupsForUser(First(Office365Users.SearchUser({searchTerm: TextInput1.Text})).Id).value
    )

    You could use the Office365Users.SearchUser() function to get the User Id for the entered user name within the Text Input Box firstly. Then use the retrieved Id result as argument value within your custom connector action.

    Note: The PowerAppsMicrosoftGraph is my custom connector name

     

    Then you could add a Data Table control in your app, set the Items property to the GroupsCollection to preview the retrieved results.

     

    Best regards,

  • winston_smyth Profile Picture
    90 on at

    Hi.

    Thank you for the response. You understood my scenario perfectly.

     

    There are some parts of your solution i dont understand.

     


    @v-xida-msft wrote:

     

     

    As an alternative solution, I think the combination of Office 365 Users connection and your custom connector could achieve your needs. On your side, you just need to specify the action path within your custom connector based on the Graph URL that you mentioned.

     

     


    Im unsure what this action path will be. My understanding was that the action path would be the full url, in my case:

     

    https://graph.microsoft.com/v1.0/users/{User ID}/memberOF

     

    But as you mentioned, I cant set a variable for USER ID in my custom connector. 

    In your solution, what action path url and json body do you use in the custom connector?

     

     

  • winston_smyth Profile Picture
    90 on at

    Update, I got this resolved, it is possible to have a variable in an action of a custom connector.

    In my case the action url looks like this:

    https://graph.microsoft.com/v1.0/users/{User ID}/memberOF

     

    When the connector is used, i can simply pass in UserID to the action that uses this URL.

  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @winston_smyth ,

    Based on the statement that you mentioned, I think you have some misunderstanding with my solution Provided above. The solution I provided above is actually the solution you mentioned here.

     

    Firstly, within your custom connector, you should specify your action path as below:

    https://graph.microsoft.com/v1.0/users/{User ID}/memberOF

    the {User Id} path parameter would be acted as a dynamical value, then you could assign proper User Id/User Email address for this argument when you use this custom connector action in a canvas app.

     

    Within your canvas app, you could add a Office 365 Users connection as data source, then you could use the 

    First(Office365Users.SearchUser({searchTerm: TextInput1.Text})).Id

    to get corresponding User Id value (e.g. 2907f6a2-xxxx-403d-xxxx-cd177a5e1595) based on the entered user name within the User Name Text Input Box. Then you could pass above formula result as value for the User Id argument within your custom connector action, then you could get related groups based on the passed user id value.

    1.JPG

     

    If you have solved your problem, please consider go ahead to click "Accept as Solution" to identify this thread has been solved.

     

    Best regards,

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 393 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 278 Most Valuable Professional

Last 30 days Overall leaderboard