共用方式為


showing items saved to My links on sharepoint site filtered by group

I’m working on a Search oriented portal using FAST search, one of the requirements we have is the ability to save currently executed search so users can re-run the search at a later point of time. We wrote a custom web part that leverages “My Links” to save the search query URLs. We needed to display all the saved searches in “My Links” in a web part page within Sharepoint site, so I started looking at QuickLinksMicroView webpart to accomplish this. Incase you guys are not familar with QuickLinksMicroView webpart, if you try to add this webpart to the page you won’t find it, you have to go to webpart gallery add it to the gallery and then you should be able to insert to page. This worked great to a certain extent, problem was as users started adding other links to “My Links” obviously it started to show up in the webpart and we needed to have a filtered view of this to show just the links grouped under “My Searches” group. Unfortunately QuickLinksMicroView webpart had no way of achieving this filtered behavior we needed. In this post I will walk through how you can use dataview and user profile webservice with bit of custom XSLT to show items from “My Links” filtered by group

Insert Dataview webpart, for data source expand xml web services and click on “connect to a web service” link

showquicklinks1

This will bring up the data source properties window, enter user profile web service URL, from operation dropdown list of select “GetUserLinks” and click on ok to close the data source properties

showquicklinks2

After inserting the data view on to the page, from the common data view tasks menu click on parameters

showquicklinks3

 

 

In the Data View Parameters define 2 new parameter binding, one for current user, source for this parameter will be “AUTH_USER” “Server Variable” and the other one will be used for filtering data view to show only items in a specific group, source for this parameter will be query string

showquicklinks4

showquicklinks5

Next task is to define a filter for the data view, to do this from the common data view tasks select filter option

showquicklinks6

In the filter criteria dialog box define filter clause, from the field name dropdown select “Group” and for Value select “LinkGroup” parameter which we defined earlier.

Click on ok to close out the filter criteria dialog. Now we are ready to test this data view webpart

showquicklinks7

For the purpose of demo I saved bunch of links to “My Links”

showquicklinks8

View below shows “My Links” for group “General”. When the parameter was defined I used “General” for default value

you can change this to different value to meet your needs.

showquicklinks9

View below show “My Links” for group “Best Bets”, group is passed via query string as shown in screen print

showquicklinks10

I also modified the XSL contained within the dataview web part to customize rendering. Hope this was useful, Email me if you are interested in an export of the data view webpart.

Technorati Tags: SharePoint,DataView,UserProfileService,Customization

Comments