Thank you for visiting my site!

Home / PowerApps - Forms / Check if user is part of a SharePoint group – PowerApps App calls a Flow

Check if user is part of a SharePoint group – PowerApps App calls a Flow

Create a flow  that takes variables from PowerApps,
check is user is in a group,
and returns a variable with the result.

1. create a flow that can be started from Power with a button.

2. create the in variable from PowerApps

3. Send an HTTP request to SharePoint,
_api/web/sitegroups/getByName(‘use inGroupnameValue’)/Users?$filter=Email eq ‘use inGroupName_Value’

_api/web/sitegroups/getByName('@{triggerBody()['inGroupName_Value']}')/Users?$filter=Email eq '@{triggerBody()['inUserEmail_Value']}'


(or if you use Get my profile )

test the output.

 body('HTTPrequest')['d']['results']

 

4. To test it out.

Create canvasApp with a button on it. add the connection to the flow created above.

On Button select Run the flow, and pass the variables.

 

 
'flow_name'.Run(
    "groupName",
    "email@email.com"
)

5. check the array value returned from HTTP is greater than 0

length(outputs(‘HTTPrequest’)?[‘body’][‘d’][‘results’]),
and set a variable to true or false.
6. Send a variable back to powerApp.

In PowerApp:

add the script on button

 

UpdateContext(
{
result: 'Flowname'.Run(
txtUserGroup.Text,
txtUserEmail.Text
)
}
);

Set( isAdmin, If(result.outisuser = "True", true, false)) 

 

ADD YOUR COMMENT