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

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.

@mdevaney  Thank you!! that worked perfectly!

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

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (1,722)