How to filter list values based on current user profile? UserContextFilter Web Part
Posted by zieglers on February 17, 2009
In this article I’ll try to show you how to use UserContextFilter web part. UserContextFilter web part can be used in situations where you’d like to filter other web parts based on a property value of the current user. Mostly this filter criterion is current user id. However, in some cases one may need to use any of the user profile property values such as Title, Department, and Email … etc.
For this article I chose a simple scenario: We’ll add a Tasks web part and by using UserContextFilter web part only tasks assigned to current user will be shown.
Here are the details:
- 1. Create a Team Site and delete all web parts on default.aspx page.
- 2. Add Tasks web part.
- 3. Add Current User Filter WP.
This web part is only viewable in edit mode, and it needs to be configured prior to use.
- 4. Add a connection to Tasks web part.
- 5. Select “Assigned To” as Consumer Field Name and click “Finish”.
- 6. Test UserContextFilter web part.
- a. Create a test user called “testuser“
- b. Assign this user to the test site’s visitors group.
- c. Before signing in as testuser, create a sample task for this user.
- d. Now sign in as test user. Tasks web part, which is being filtered by UserContextFilter web part, should be displaying testuser’s tasks as follows.