In SharePoint 2010, you may have noticed the button at the top right corner of all of the pages, called “I Like It”. This button basically just adds a tag (I Like It) to the item, but it’s not readily apparent WHY you would want to use that button. You can go to your My Site profile, and click the Tags and Notes tab, click “I Like It” under Refine By Tag on the left, and see the stuff you like filtered on the right, like this:
I saw a tweet the other day by @ChrisO_Brien, and it inspired me:
In this blog post, I’ll show you how to create a web part that simply shows the logged in user a list of items that they have tagged with I Like It. This can be used as a handy list of favorites. Here’s how:
- Open your site in SharePoint Designer, and click Data Sources on the left.
- In the ribbon, click to create a new SOAP Service Connection:
- Use the social data web service to get the info about the current logged in user’s tags:
Service description location – This is the URL of your site before the /_vti_bin
We’re using the SocialDataService.asmx
Operation – Select GetTagsOfUser
userAccountName – I went ahead and put my own account in there, because you’ll get an error if you leave it empty, I’ll show you how to remove it later. Also, check the box so that the value of the parameter can be set via a web part connection.
MaximumItems… – I just set it at 50, I don’t think it matters, but it is a required field.
StartIndex – 1
- On the Login tab, choose Windows Authentication, and on the General tab, you can just make up a name such as Social Data.
- Click OK
- Create a blank web part page, and open that web part page in SharePoint Designer 2010.
- Put the cursor in a web part zone, click the Insert tab in the ribbon, and click the Data View button.
- Click the name of the data source “Social Data” that you just created. This will put the data on the page, with a set of random columns.
- On the Options tab in the ribbon, click the Add/Remove Columns button. It really is up to you, but I removed all except for Title.
- Click the Filter button in the ribbon. Filter the list so that tag equals I like it.
- Click on the Title value of one of the items in the list, and click the little grey chevron next to it:
- For Format As, choose Hyperlink, and configure the settings like this, with the Title as the text to display, and the URL as the address.
- In the Options tab in the ribbon, click Parameters. For the userAccountName, clear out the default value:
- Click the Filters button again, and add one more filter. Owner equals [userAccountName].
- Save and hit F12 to preview this page in the browser.
- Add the Current User Filter web part to the page. In the web part properties, for the profile value, select Account name from the drop-down box.
- Create a new web part connection, sending the value from the current user filter web part as the parameter (parameter NOT filter) in the social data web part, the userAccountName.
DONE. Now the web part will display the current logged in user’s stuff they like. You can export this web part now, and import it to put it on any page in the site collection. Chris, can you pass this info on to your colleague?
On a related note, here is another post that I wrote last year: SharePoint 2010 – Where’d “My Links” Go?