cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TomSlosse
Level: Powered On

Filter SharePoint list on Current User

Hello everyone!

 

We would like to filter the data from our SharePoint list 'Travel Request' on the traveler (being the current user of the PowerApps).

 

E.g. Request 1:

Traveler: John Doe

Destination: New York

 

When the PowerApps User is Jane, she can not see this request in the BrowseGallery.

When it's John Doe, he can see his request.

 

PowerAppke.PNG

 

Thanks in advance!

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
PowerApps Staff murali
PowerApps Staff

Re: Filter SharePoint list on Current User

How may travel requests are there? over 500? If so, delegation might be what is causing this issue.

 

To workaround this, please do the following:

 

1. Screen.OnVisible = UpdateContext({UserEmail: User().Email}) 

 you could also do Screen.OnVisible = UpdateContext({UserName: User().FullName}) though i recommend Email as that is guaranteed to be unique.

 

2.

Filter('Travel Request', Traveler.Email = UserEmail)

I assume Traveler is a Person type in SharePoint.

 

I am also seeing some error icons in the screenshot you posted. Are you sure there is nothing else wrong?

 

Let us know if this worked. 

 

Thanks

Murali

View solution in original post

23 REPLIES 23
Meneghino
Level 10

Re: Filter SharePoint list on Current User

Hi. Try this:

Filter('Travel Request', User().Email=Traveler.Email)

 

Please let me know if it works. 

PowerApps Staff murali
PowerApps Staff

Re: Filter SharePoint list on Current User

How may travel requests are there? over 500? If so, delegation might be what is causing this issue.

 

To workaround this, please do the following:

 

1. Screen.OnVisible = UpdateContext({UserEmail: User().Email}) 

 you could also do Screen.OnVisible = UpdateContext({UserName: User().FullName}) though i recommend Email as that is guaranteed to be unique.

 

2.

Filter('Travel Request', Traveler.Email = UserEmail)

I assume Traveler is a Person type in SharePoint.

 

I am also seeing some error icons in the screenshot you posted. Are you sure there is nothing else wrong?

 

Let us know if this worked. 

 

Thanks

Murali

View solution in original post

TomSlosse
Level: Powered On

Re: Filter SharePoint list on Current User

Hi murali

 

 

Sorry for the delay.

 

Well my problem is that i can't type in comma's in that particular screen.

Maybe that is my problem, but i don't know how to fix it and if it could get fixed maybe your solution will work.

 

And yes Traveler is indeed a person.

 

 

Thanks in advance

 

Tom Slosse

PowerApps Staff murali
PowerApps Staff

Re: Filter SharePoint list on Current User

The list separator is based on your locale settings. Try using ; instead and also check in your regional settings. For instance, it's , for me.

 

listseparator.PNG

Highlighted
johandeweerdt
Level: Powered On

Re: Filter SharePoint list on Current User

Hi, above does work although:

- when saving the current users email to the variable it saves it without capitals. (example: "de.weerdt.johan@xxx")

- when trying to apply the filter on the Person-field as described by @murali, it only works when I manually use the text "De.Weerdt.Johan@xxx" --> see capitals. How to handle this?

Meneghino
Level 10

Re: Filter SharePoint list on Current User

Hi @johandeweerdt, there is a simple solution using the Lower function.

 

I knew that PowerApps was case-sensitive but I didn't realise that this extended to string comparisons, thanks for making me notice that.  I will  be more careful in future.

 

Try this:

 

Filter('Travel Request', Lower(Traveler.Email) = Lower(UserEmail))

Please let me know if this does not work, as there may be issues related to the delegation of the Lower function.

 

Please see the screenshots below for demo.

 

__.JPG000.JPG

johandeweerdt
Level: Powered On

Re: Filter SharePoint list on Current User

thanks for the quick reply. Altough this does solve this particular issue, I'm still a bit worried about the fact that we try to compare the exact same object (email of a 'person') where the first version (= Person.Email coming from Person field of the SharePoint list) is in capitals and the other (=Email of Current User) is not in capitals?

Both are the same 'Person' in active directory and thus the same email?

Meneghino
Level 10

Re: Filter SharePoint list on Current User

You are welcome.

Emails are not case sensitive, so the issue you raise does not worry me too much.

The difference could be that athough both come from active directory (I guess, but I am not an expert) one comes from the SharePoint instance, while the other comes from the Office365 instance, and one or the other could eliminate the un-necessary capitalisation of emails when synchronising with active directory.

This is all wild speculation as I am not an expert.

Anyway, glad to be able to help.

Grahambo05
Level 8

Re: Filter SharePoint list on Current User

@murali

 

I have the same value for Screen.OnVisible 

 

For Filter('Sharepoint List', Author.Email = UserEmail , the ".Email" is being highlighted for service limitations. Are there service limitations for " || " or operator in a gallery.items filter?

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 (Last 30 Days)
Users online (4,839)