.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> SharePoint >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Using Me to Filter in Users in SharePoint

Posted By:Jean Paul       Posted Date: July 17, 2014    Points: 200    Category: SharePoint    URL: http://www.dotnetspark.com  

In this article we have explored the [me] parameter to filter in multiple values too in SharePoint
 

In this article we can explore 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 are having a List with Members column, which contains multiple users. We need to filter the list based on current user.

For example if there are User1, User2, User3 in the Members column, If User1 is logged in; he should be able to see the item. We can apply the [Me] tag to filter in multiple selection column too.

Step 1 Create Projects list

Open your SharePoint site & create a List of type  custom & name it as Projects.

image

Open List Settings & choose the Create Column option.

image

Enter the new column name as Members of type Person or Group and allow multiple values, as shown below.

image

Click the OK button to continue.  After adding the column your list columns looks like below.

image

Step 2 Create Users

We need 3 users for our scenario.

1. If you are using Windows client operating system, use Control Panel to add the users

2. If you are using Windows server operating system, use Active Directory to add the users

User 1: Employee 1

User 2: Employee 2

User 3: Manager

Please ensure you have added Password for all the 3 users. (else certain browsers won't allow login without password)

image

Now we are ready with our 3 users.

You need to perform the following to bring the above 3 users within SharePoint.

1. Go to Central Administration > Services > Stop User Profile Synchronization Service

2. Run IISRESET command after few seconds

Now, add the 3 users to the Site Members group.  Open Site Actions > Site Permissions > Find Members group > Add users

image

Click the OK button & now the new 3 users have Contribute permissions to read/modify list items.

Step 3 Add Data

Now we are ready to add some data to the list.    

Open the list & add Project 1 with Employee 1 & Manager

image

Open the list & add Project 2 with Employee 2 & Manager

image

Now we are ready with following 2 items.

image

Please note that Employee 1 have only 1 project associated & Employee 2 have only 1 project associated.

The current view shows both the records, regardless whoever is logged in.

Step 4 Create View Filter

image

Now we can create our View Filter.  Go to List Tab of Projects list & click the Create View button.

In the appearing window choose the Standard View as shown below. 

image

In the appearing page, enter the view name as Current User View & make it as the default, as shown below.

image

Scroll down to the bottom & in the Filter section add the following:

image

Please note that we are enabling a filter which checks the Members column is equal to the current logged in user which is denoted through [me].

Click OK button to continue.

Step 6 Test It

Now from the user menu on the right hand side, choose the Sign in as Different User option.

image

Sign in as Employee 1 & you should see the current items.

image

Please note that the Employee 2 item is hidden as per the View Filter.

References

http://bit.ly/10uiVpB

Summary

In this article we have explored the [me] parameter to filter in multiple values too.


 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend