cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ToFj
Helper II
Helper II

App permission based on People/group column in Sharepoint

Hello, 
I have several Powerapps that need to be open to everyone on our Sharepoint page, but where several functions need to be hidden/disabled. The way I want to do this (atleast short term) is for the app to check if the email of the current user is in a Sharepoint list and then change a global variabel based on that. I have tried with the following code in the screens "on visible" control, but unfortunately it doesn't work.

If(User().Email in AdminList.ElectronicMail; Set(Admin;true); Set(Admin;false))

I am suspecting the issue is that i can not properly connect it with the data within the column "ElectronicMail" because this is a person/group column. Because I made a test with a single line of text column and this seemed to work

If(User().FullName in AdminList.Name; Set(Admin;true); Set(Admin;false))

Does anyone have any tips for me? Would really appreciate it. 


1 ACCEPTED SOLUTION

Accepted Solutions
yashag2255
Dual Super User II
Dual Super User II

Hi @ToFj 

 

Thank you for sharing additional details. Can you try to update the expression to:

If(CountRows(Filter(AdminList; User().Email in ElectronicMail.Email)) > 0; Set(Admin;true); Set(Admin;false))

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

4 REPLIES 4
yashag2255
Dual Super User II
Dual Super User II

Hi @ToFj 

 

Can you try to update the expression to:

 

If(User().Email in AdminList.ElectronicMail.Email; Set(Admin;true); Set(Admin;false))

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Hi @yashag2255, thank you for the reply. 

I have tried this because each entry in the "ElectronicMail" column contains Name, title, email etc. but the Intellisense doesn't give me any options after typing Adminlist.ElectronicMail. 

However, if I do something like this in a label it gives me this option. 
LookUp(AdminList; User().Email in ElectronicMail.Email; "MATCH")

Any ideas why this might be the case? 

yashag2255
Dual Super User II
Dual Super User II

Hi @ToFj 

 

Thank you for sharing additional details. Can you try to update the expression to:

If(CountRows(Filter(AdminList; User().Email in ElectronicMail.Email)) > 0; Set(Admin;true); Set(Admin;false))

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Thanks @yashag2255, this seems to run perfectly. 

Do you have any idea why Powerapps doesn't allow me selected AdminList.ElectronicMail.Email directly in an IF function like you suggested previously? 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

Top Solution Authors
Top Kudoed Authors
Users online (45,898)