In this SharePoint tutorial, we will see, how to work with the Current User Filter in SharePoint 2013 Online. In the same way, we can use the current user filter web part in SharePoint Online or SharePoint 2013/2016/2019.
We will use the Current User Filter web part with a SharePoint list view web part.
SharePoint current user filter web part
In this particular example, I have a sample list that has two columns one is Title and CreatedByFirstName. Here we will filter the records based on logged in user’s first name using the current user filter web part in SharePoint.
SharePoint has inbuilt filter criteria presented with [Me] which will work with People picker field type, like Created by [Me] or Modified by [Me]. But this will be helpful in other cases where you will not have a people picker, maybe a single line text and you want to filter on other user profile properties like the first name, last name, department, etc.
Here is our custom SharePoint Online list look like:
Now let us say I am logged in with Bijay Sahoo and here I want to filter records based on First Name. So If I open it should show records where the filter criteria “CreatedByFirstName” is Bijay.
So for this, I have created a sample web part page in SharePoint site. On that page First I add the list view web part (MyTest List).
For this Edit the page -> Add web part than from Categories select “Apps” and then select MyTest list from the list of apps, then click on Add. Once you will Save the page it will display all the records.
Now again Edit the SharePoint web part page and click on Add a Web Part. Then From the Categories Filters -> then add “Current User Filter” web part as shown in the fig below:
Then select the web part and then click on Edit Web part as shown in the fig below:
Then in the Current User Filter web part properties, you can see like below. It will display the current username in the format of i:0#.f|membership|[email protected].
But here our requirement is to filter based on the First Name. So I need logging in the user’s first name. So for this select the second radio button “SharePoint profile value for current user”. Now in this dropdown, it will show what are the properties (user profile properties) are available.
From there select the Last Name as shown in the fig below. You can select as per requirement like department, last name, username, work email, etc. Then click on OK.
Then edit the web part again. Click on Connections -> Send Filter Values To -> Then select the list [Here it is MyTest]. Here make sure pop up is enabled here.
Then it will display the Choose connection popup. Here in the Connection Type select “Get Filter Values From” and then click on Configure as shown in the fig below:
Then on the next screen (tab). By default, the “Provider Field Name Current User” will come. In the Consumer Field Name select the list column name which you want to filter. Like here I want to filter based on CreatedByFirstName column from the column’s dropdown as shown like below:
Then click on Finish. And Stop editing and save the page.
Now if you will refresh the page, you will be able to see the items created by logged in users the first name as shown in the fig below:
You may like the following SharePoint web part tutorials:
- RSS Viewer Web Part in SharePoint
- Site Feed web part in SharePoint 2013/2016/Online
- Create SharePoint Quote of the day web part using Rest API and Bootstrap
- SharePoint Online calendar web part
- Enable Chart Web Part in SharePoint 2013/2016/Online
- How to use office UI fabric react groupedlist in SPFx web part
- SharePoint online spfx script editor web part
- How to implement pagination in repeater control in SharePoint web part
- File viewer web part in SharePoint Online modern site
- SharePoint Online modern list properties web part
Here, we learned how to use the current user filter web part in SharePoint Online or SharePoint 2013/2016.
Bhawana Rathore is a Microsoft MVP (3 times in Office Apps & Services) and a passionate SharePoint Consultant, having around 10 years of IT experience in the industry, as well as in .Net technologies. She likes to share her technical expertise in EnjoySharePoint.com and SPGuides.com
Bijay, thank you for this. Is there a way we can do this while maintaining the modern SharePoint look ?