cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
kevingeorget
Level 8

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
Community Support Team
Community Support Team

Re: Role based security groups in Powerapps using REST API SharePoint

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
Super User
Super User

Re: Role based security groups in Powerapps using REST API SharePoint

@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. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
kevingeorget
Level 8

Re: Role based security groups in Powerapps using REST API SharePoint

@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.

 

Super User
Super User

Re: Role based security groups in Powerapps using REST API SharePoint

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

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Community Support Team
Community Support Team

Re: Role based security groups in Powerapps using REST API SharePoint

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

kevingeorget
Level 8

Re: Role based security groups in Powerapps using REST API SharePoint

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

ebnavarro
Level: Powered On

Error on Converting Image to Text

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
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 105 members 5,428 guests
Please welcome our newest community members: