cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

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
Highlighted
Power Apps
Power Apps

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
Highlighted
Community Champion
Community Champion

Re: Filter SharePoint list on Current User

Hi. Try this:

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

 

Please let me know if it works. 

Highlighted
Power Apps
Power Apps

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

Highlighted
New Member

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

Highlighted
Power Apps
Power Apps

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
Frequent Visitor

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?

Highlighted
Community Champion
Community Champion

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

Highlighted
Frequent Visitor

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?

Highlighted
Community Champion
Community Champion

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.

Highlighted
Advocate IV
Advocate IV

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,900)