1

So finally I know how to get users groups using HTTP request to SharePoint in This question.

Now I need to display these groups as list in Power App. (Or it can be organized text).

The raw output looks like this (rest of group outputs are similar):

enter image description here

My flow already looks like this:

enter image description here

Now I'm looking for a solution how to filter only a "Title" of all groups and display them.

1 Answer 1

1

You can collect the group names in a string variable & pass it to the power apps using "Respond to a PowerApp or flow" action. Configure your flow actions like this:

enter image description here

  1. Formula used as input to Apply to each:
body('HTTP_request_to_SP_-_Get_User_Groups')['d']['results']

You need to replace this 'HTTP_request_to_SP_-_Get_User_Groups' with your action name (with _ instead of space in action name).

  1. Formula used in Append to string variable action:
concat(item()['Title'], ';;')
  1. Pass userGroupNames variable in "Respond to a PowerApp or flow" action.

You can enter these formula in Dynamic content section of respective flow actions.


Make below changes in Power Apps:

//Get SP groups of current user
Set(userGroupNamesString, FlowName.Run(User().Email).usergroupnames);

//Get collection of user group names
ForAll(Split(userGroupNamesString, ";;"), Collect(colUserGroupNames, Result));

You can use this collection colUserGroupNames to show group names in your app for example:

  1. Add gallery control in your app & set items property of app to colUserGroupNames.
  2. Add label control inside gallery & set it's Text property to: ThisItem.Value

Output:

enter image description here

7
  • I'm still working on this solution, sorry for late response due the lack of time. Could you please be more clear in part when you write about "Make below changes in PowerApps"? I guess you mean the StartScreen control in App element, is it right?
    – Yarensky
    Jul 26, 2022 at 19:21
  • Are you trying to fetch user groups when app starts? If yes, you need to write above code in OnStart property of App element. Jul 27, 2022 at 4:26
  • Well, I don't need to fetch user groups already on app start. Main goal was to fetch them after clicking button. So I'm not sure where I have to write //Get SP groups of current user formula
    – Yarensky
    Jul 27, 2022 at 7:18
  • In that case, you have to write the complete formula in OnSelect property of the button control. Jul 27, 2022 at 7:39
  • Sorry for no response. I will post a comment with actual results of this solution in a few days. Thanks for patience
    – Yarensky
    Jul 29, 2022 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.