This article explores an additional a real-world scenario. The View Filter parameter [Me] can be used to filter one user as well as multiple users.
This article explores an additional a real-world scenario. The View Filter parameter "[Me]" can be used to filter one user as well as multiple users.
In our experiment, we have a List with a Members column, that allows multiple users:
We need to filter the list based on the current user. We can use the "[Me]" in the View Filter option.Step 1: Create Projects listOpen your SharePoint site and create a List of type custom and name it "Projects".Open the List Settings and choose "Create Column".Enter the new column name as members of type Person or Group and allow multiple values, as shown below.Click the "OK" button to continue. After adding the column your list columns looks as in the following.Step 2: Create UsersWe need 3 users for our scenario as in the following:
User 1: Employee 1User 2: Employee 2User 3: ManagerPlease ensure you have added a password for all 3 users (else certain browsers won't allow login).Now we are ready with our 3 users.You need to do the following to bring the preceding 3 users within SharePoint.
Now, add the 3 users to the Site Members group. Open "Site Actions" > "Site Permissions" > "Find Members group" > "Add users".Click the "OK" button and now the 3 new users have "Contribute" permissions to read/modify list items.Step 3: Add DataNow we are ready to add some data to the list. Open the list and add Project 1 with Employee 1 and Manager.Open the list and add Project 2 with Employee 2 and Manager.Now we are ready with following 2 items.Please note that Employee 1 has only 1 project associated with it and Employee 2 has only 1 project associated with it.The current view shows both records, regardless of whoever is logged in.Step 4: Create View FilterNow we can create our View Filter. Go to the "List" Tab of the Projects list and click the "Create View" button.In the window that appears choose the "Standard View" as shown below. In the page that appears, enter the view name as "Current User View" and make it the default, as shown below.Scroll down to the bottom and in the Filter section add the following:Please note that we are enabling a filter that checks if the Members column is equal to the current logged in user that is denoted through "[me]".Click the "OK" button to continue.Step 5: Test ItNow from the user menu on the right hand side, choose "Sign in as Different User".Sign in as Employee 1 and you should see the current items.Please note that the the Employee 2 item is hidden as per the View Filter.SummaryIn this article we have explored the "[me]" parameter to filter multiple valued user columns.
SharePoint Framework (SPFx) A Developers Guide