cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kevingeorget
Resolver I
Resolver I

Role based security groups in Powerapps using REST API SharePoint

Hi PowerApp Users,

I'm trying to implement Role based secuirty in my SharePoint PowerApp list forms using Flows. I followed the below blog-

https://svaghub.wordpress.com/2018/11/03/role-based-security-in-powerapps-using-spgroups/

When i save and open the form, i get the below error-

UserBasedRoleSecurity.Run failed: { "error": { "code": 502, "source": "europe-001.azure-apim.net", "clientRequestId": "dee98c8d-29e1-48d1-b305-457eb07d067e", "message": "BadGateway", "innerError": { "error": { "code": "NoResponse", "message": "The server did not received a response from an upstream server. Request tracking id '08586507545698914509316500698CU95'." } } } }

 

The issue is with the 'Send an HTTP request to SharePoint' step in the flow.

The Uri is -

api/web/sitegroups/getByName(‘TestUsers’)/Users?$filter=Email eq ‘@{triggerBody()['SendanHTTPrequesttoSharePoint_Uri']}’

Has anyone tried this and had luck?

Any help appreciated.

Regards,

Kevin

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @kevingeorget ,

Could you please share a screenshot about your flow's configuration?

Which action occurs this issue when you executed the UserBasedRoleSecurity.Run() function within your app? Is it the "Send an HTTP request to SharePoint" action within your flow?

Based on the error message that you mentioned, I think this issue may be related to the "Send an HTTP request to SharePoint" action within your flow.

 

Please check if you have specified a proper Site Address within the Site Address field of the "Send an HTTP request to SharePoint" action within your flow.

In addition, please also check if you have typed a proper Request URL within the Uri field of the "Send an HTTP request to SharePoint" action within your flow. Based on the URL that you provided, I think there is something wrong with it, you have missed a underscore (_) character before the URL. Please modify your URL as below:

_api/web/sitegroups/getByName(‘TestUsers’)/Users?$filter=Email eq ‘@{triggerBody()['SendanHTTPrequesttoSharePoint_Uri']}’ /* Add a underscore (_) character before your URL*/

Please also check if the connection you created to the "Send an HTTP request to SharePoint" action in your flow have enough permission to perform the corresponding Request URL.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
RandyHayes
Super User
Super User

@kevingeorgetthis is not a direct answer to that issue, but perhaps something to look at - 

Have you looked that the Azure AD Connector for PowerApps?  If you're trying to determine if a user is in a group, you can use the GetGroupMembers function on that connector to get a collection of members and then do a check against it for the current user.

Just a suggestion to not have to deal with the flow method. 

However, if you want to Flow with it - you can also use that Connector in Flow (with more functions exposed).

If you want to do raw REST API connection - there are a bunch of articles out there on it.

 

Hope this provides some help.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes thanks for the reply. However, my security groups are SharePoint groups having users rather than AD groups, so this approach won't work for me.

 

@kevingeorgetlike I mentioned, not a direct answer, just a potential solution depending on your scenario.  

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
v-xida-msft
Community Support
Community Support

Hi @kevingeorget ,

Could you please share a screenshot about your flow's configuration?

Which action occurs this issue when you executed the UserBasedRoleSecurity.Run() function within your app? Is it the "Send an HTTP request to SharePoint" action within your flow?

Based on the error message that you mentioned, I think this issue may be related to the "Send an HTTP request to SharePoint" action within your flow.

 

Please check if you have specified a proper Site Address within the Site Address field of the "Send an HTTP request to SharePoint" action within your flow.

In addition, please also check if you have typed a proper Request URL within the Uri field of the "Send an HTTP request to SharePoint" action within your flow. Based on the URL that you provided, I think there is something wrong with it, you have missed a underscore (_) character before the URL. Please modify your URL as below:

_api/web/sitegroups/getByName(‘TestUsers’)/Users?$filter=Email eq ‘@{triggerBody()['SendanHTTPrequesttoSharePoint_Uri']}’ /* Add a underscore (_) character before your URL*/

Please also check if the connection you created to the "Send an HTTP request to SharePoint" action in your flow have enough permission to perform the corresponding Request URL.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

@v-xida-msft Thanks so much for the reply. Yes, it was the issue with the '_'. Didn't realize that.

ebnavarro
Frequent Visitor

flow.png

error.png

Please help me. I am new to Powerapps. I cant resolve the attached image above.

I have a connector to Computer Vision API with free trial and a Flow but still has an error.

 

Thank you for your help.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,906)