cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TommySandtorv
Frequent Visitor

Filter gallery based on current user

Hello,

Have looked through similar questions in the forum, but could unfortunately not find a suitable solution for my problem.

 

We've created an Power App where user reports to a SharePoint list. On start of the application the User is saved in a variable

Set(AppUser, User());

 

One of the screens in the application shows an overview of the items created by the user

Filter(SharePointList, Author.DisplayName = AppUser.FullName || Author.Email = AppUser.Email)

 

This works fine for most users. However, we've had a case where one of the user has a middle name/second surname in the user function, while not in the Author field. And the Email addresses are alias of the email uses in the author field. Which results in this user not getting items shown in this overview even though he created items from the application.

 

Any ideas on how to solve this issue? Any help is highly appreciated. 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @WarrenBelz

 

The solution we went for was to use the MyProfile() function provided in the Office 365 User connector.

Office365Users.MyProfile()

The object which is returned from this function is the same as the field used by SharePoint do decide the author. For some reason the built in User() function does not always match the author field.

View solution in original post

3 REPLIES 3
WarrenBelz
Super User
Super User

Hi @TommySandtorv ,

I am wondering how a user's middle name does not get into the Author field (I assume you are dealing with a collection here) when it is created from the User's name in the first place. I find that the email (which is unique) is all that is needed . To answer your question, there is no real solution if you cannot rely on the created by field (which becomes Author in a collection) as a match for the logged-in user unless you want to have a reference table for all users and lookup the actual value you need.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

WarrenBelz
Super User
Super User

Hi @TommySandtorv ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Hi @WarrenBelz

 

The solution we went for was to use the MyProfile() function provided in the Office 365 User connector.

Office365Users.MyProfile()

The object which is returned from this function is the same as the field used by SharePoint do decide the author. For some reason the built in User() function does not always match the author field.

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

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.

Users online (2,760)