MOSS 2007 comes with a number of filter web parts that makes it really easy to filter your SharePoint lists by connecting filter web parts with list view web parts.
Note: These are only available in MOSS enterprise edition and could only be applied to “All Items” view or to view configured as “Standard View” type
I would walkthrough in this tutorial to filter a list items based on User Location (mapped to Office profile property in the User Profile repository).
Background
There are list of courses stored in a custom list called “Courses”. The requirement is to display courses only available in current logged user’s location. The easiest way would be to create a view on the list and set the filters. Ironically, there is not inbuilt [Location] attribute like [Me] or [Today]. You could filter the view on [Me.Office] as shown below
The other way is to use the Current User Filter. With the Current User Filter you can filter the contents of web parts by using any property of the current user.
Steps
1. Create a List called Courses
|
2. Add couple of items to this list with different location. Make sure one record have location same as your location. In this example, current user’s Office profile property has value as “Melbourne”.
3. As the list page is a web part page, you could easily add web parts to this using User Interface.
4. Click Site Actions -> Edit Page
5. On the top of the list, click “Add a new Web part” and select web part “Current User Filter”
6. Edit the newly added web part “Current User Filter” by clicking Edit -> Modify Shared Web part
7. Click “SharePoint profile value for current user” and select “Office” from dropdown
8. Press OK.
9. Now, we need to make a connection between this web part and courses list. On “Current User Filter” web part, click Edit -> Connections and Select Courses
10. You would be prompt with a dialog box, select the List field which need to be mapped to the User’s Office attribute.
11. Click Finish and Exit the edit mode. You would now only see the items in list which have location same as your Office.
6 comments:
Dear Author,
I tried to test your example : were Location (single line of text) is equal to [Me.Office]
It isn't work. In user profile Office field is filled.
Could you please check?
Current User Filter WP didn't match. I need to filter list items on 3 my profile fields(office, department and community). In Current User Filter I can choose only one value.
Thank a lot!!!
Dear Author,
I tried to test your example : were Location (single line of text) is equal to [Me.Office]
It isn't work. In user profile Office field is filled.
Could you please help?
Current User Filter WP didn't match. I need to filter list items on 3 my profile fields(office, department and community). In Current User Filter I can choose only one value.
Excellent. Thank you!
Sanjay, I am trying to filter a SharePoint list based on current logged user's profile property. I have seen your two ways to achieve it. I want to implement you first way to use an attribute like [Me.ProfilePropertyName] Where ProfilePropertyName may be any of the current user's property name. But its not working for me, its not filtering my list. I searching in web to find explanation on your first method, but no luck. I don't want to use Current User Filter.
Can you tell me where I am going wrong?
Sanjay, I am trying to filter a SharePoint list based on current logged user's profile property. I have seen your two ways to achieve it. I want to implement you first way to use an attribute like [Me.ProfilePropertyName] Where ProfilePropertyName may be any of the current user's property name. But its not working for me, its not filtering my list. I searching in web to find explanation on your first method, but no luck. I don't want to use Current User Filter.
Can you tell me where I am going wrong?
Anonymous,
If you want your list to be filtered with three profile properties... then create three current user filters for each of your profile property... but by default a SharePoint list will accept filter values from only one filter.... So convert your SharePoint list into Data View Web Part using SharePoint Designer ... then the list will accept filter values from multiple filters...
Post a Comment