cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jakebroom
Regular Visitor

Getting specific row data based on logged in user.

Hi all,

 

I am currently trying to figure out how to get specific row of data from a SharePoint list based on the currently logged in user. 

 

The share point table looks like the below:

 

NameUsernamedays left
name1user112
name2user215

 

The user name field in the SharePoint table is set as type "username".

 

So basically i am trying to get is so that if user1 is logged in then it only shows their days left in the form.

 

I have already tried setting the permissions on the table to allow the user to only see their data, however this doesn't work as the end user doesn't enter the data into the table.

 

Any help on this would be very much appreciated,

 

Thanks,

 

Jake

3 REPLIES 3
mdevaney
Super User
Super User

@jakebroom 

You can detect the email of the currently logged in user with this code.

User().Email

 

If you create a new column called UserEmail in your SharePoint list you can perform a FILTER like this.

Filter(your_datasource_name, UserEmail = User().Email)

 

Or if an existing field (example: Name) is a Person type field you can use code like this.

Filter(your_datasource_name, Name.Mail = User().Email)

 

 

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

brimstone
Advocate I
Advocate I

Hi @jakebroom 

 

Edit: Just saw that mdevaney was faster...

__

 

You should be able to get your result with the Filter-Function.

This can look like this:

 

Filter( SharepointList, Username = user1 )

 

You just need to make sure that you have e.g. a variable set with the name of user1 so he can filter correctly.

For example on your OnVisible or OnStart:  

Set( ThisUser, User().FullName )

Then you need to exchange the user1 in the first formula with ThisUser.

Please let me know if this solves your problem or if I misunderstood it.

Hi @mdevaney ,

 

Is it possible that you also help me with my topic. Let me know what are the possibilities.

 

Link: https://powerusers.microsoft.com/t5/Building-Power-Apps/Sharepoint-gt-Powerapps-gt-Outlook/m-p/45586... 

 

Thanks in advance,

Sanket

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

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