cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
_sourcecod3_
Helper IV
Helper IV

Check if user exists and compare it with

Hi all,

I'm trying to display a section of a menu to users that are in a SharePoint list. In my app i have a button for testing titled "Admin", when pressed, if the user is on that SP list then the navigation will display. 

 

Can someone please point me in the right direction if no examples are available? 

 

Thanks

2 ACCEPTED SOLUTIONS

Accepted Solutions
mdevaney
Super User
Super User

@_sourcecod3_ 

For example, you could create a SharePoint list called "AppAdmins", with a single Person column called 'PersonColumn'

 

PersonColumn
John Smith

 

Then in your App's OnStart property use this code to create a true/false variable.

Set(isAdmin, !IsBlank(LookUp(AppAdmins, PersonColumn.Mail=User().Email)))

 

Finally, put this code in the OnVisible property of the Admin button

isAdmin

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

eka24
Super User
Super User

Try:

If(CountRows(Filter(TableName,ColumnName = "Admin")) > 0,Notify("Exist"),Notify("Does Not Exist"))

 

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

View solution in original post

4 REPLIES 4
mdevaney
Super User
Super User

@_sourcecod3_ 

For example, you could create a SharePoint list called "AppAdmins", with a single Person column called 'PersonColumn'

 

PersonColumn
John Smith

 

Then in your App's OnStart property use this code to create a true/false variable.

Set(isAdmin, !IsBlank(LookUp(AppAdmins, PersonColumn.Mail=User().Email)))

 

Finally, put this code in the OnVisible property of the Admin button

isAdmin

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

eka24
Super User
Super User

Try:

If(CountRows(Filter(TableName,ColumnName = "Admin")) > 0,Notify("Exist"),Notify("Does Not Exist"))

 

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

View solution in original post

@mdevaney  Thank you!! that worked perfectly!

@eka24  Update: this solution worked better for my situation. Thanks Eka for this. 

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (2,219)