Web Part: “Stuff I Like” Using Social Data
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?
I Like It!
Wow. That is really cool! I can see now how it could be useful to tag things with “I like it”. Now, I just need to sell it to my users.
This is so great. I just tried doing it and it’s working on my throw-away web part page but not the page I exported it to. I gotta have a current user filter set up on the page I want to put the exported “I Like It” webpart on, right?
Marlene, I don’t know, I did the same thing, and it did work fine on the page that I imported it to after creating it on a “throw away” page like that. Yes, you do need to put both this web part and the current user filter together on the page, and connect them.
Hi Laura, This is great. But I am wondering, is it limited to just the site where the data source was built? Or is there a way to build a data view like this using a data source? Also, I tried this on the Home Page of a standard Team Site site and that will not take the Current USer Filter as it is a wiki page. Thanks.
SharePoint4You, 1. You could just put a filter in the DVWP, like with a substring function that looks at the beginning of the URL, for that particular site. 2. Wiki pages suck. You can go into Site Features and disable the “Wiki page home page” feature.
in the “Add/Remove Columns” stage, i don’t see the “Title” field. just “ddw1:GetTagsOfUserResult:” what am i missing?
Laura, I have a client request who wants to display all the recent activities of the currently logged on user such as documents, events, tasks, status messages etc. Can you advice how I can achieve this using OOTB web parts? Also, I am having trouble retrieving the status message from My Site into a webpart. Please can you advice how to retrieve the status message into a webpart? Can I use search core web part ? Thanks in advance.
Udi, Make sure you have some actual data to report on. All I can think of is that maybe the user you’re logged in as has never “Liked” something in SharePoint, so you’re not seeing any values. Kaalie, At #10, just don’t filter so that tag equals “I like it”. And I guess you could play around with that web service and see what else you can do with other operations/methods. I haven’t tried though. No, I don’t know where the status message is stored or how to retrieve it.
This is good but I am working with FBA Users so what changes required for same using FBA(Form Based Authentication) Users.
Nipesh, I’m not sure, I’ve never tried it with FBA.
Laura, Do you know of any reason any items tagged as private; will not show up in the solution?
No, but possibly they’re stored somewhere else?