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:

ch5[176]

I saw a tweet the other day by @ChrisO_Brien, and it inspired me:
ch5[177]

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:

  1. Open your site in SharePoint Designer, and click Data Sources on the left.
  2. In the ribbon, click to create a new SOAP Service Connection:
    ch5[178]
  3. Use the social data web service to get the info about the current logged in user’s tags:
    ch5[179]
    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
  4. On the Login tab, choose Windows Authentication, and on the General tab, you can just make up a name such as Social Data.
  5. Click OK
  6. Create a blank web part page, and open that web part page in SharePoint Designer 2010.
  7. Put the cursor in a web part zone, click the Insert tab in the ribbon, and click the Data View button.
  8. 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.
  9. 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.
  10. Click the Filter button in the ribbon. Filter the list so that tag equals I like it.
    ch5[183]
  11. Click on the Title value of one of the items in the list, and click the little grey chevron next to it:
    New Picture
  12. 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.
    ch5[186]
  13. In the Options tab in the ribbon, click Parameters.  For the userAccountName, clear out the default value:
    ch5[187]
  14. Click the Filters button again, and add one more filter.  Owner equals [userAccountName].
  15. Save and hit F12 to preview this page in the browser.
  16. 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.
  17. 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.
    ch5[188]

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?  Winking smile

On a related note, here is another post that I wrote last year: SharePoint 2010 – Where’d “My Links” Go?

13 comments

  • Adrian Colquhoun

    I Like It!

    Like

  • 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.

    Like

  • Marlene Lanphier

    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?

    Like

  • 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.

    Like

  • SharePoint4You

    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.

    Like

  • 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.

    Like

  • in the “Add/Remove Columns” stage, i don’t see the “Title” field. just “ddw1:GetTagsOfUserResult:” what am i missing?

    Like

  • 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.

    Like

  • 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.

    Like

  • This is good but I am working with FBA Users so what changes required for same using FBA(Form Based Authentication) Users.

    Like

  • Nipesh, I’m not sure, I’ve never tried it with FBA.

    Like

  • Laura, Do you know of any reason any items tagged as private; will not show up in the solution?

    Like

  • Jason,
    No, but possibly they’re stored somewhere else?

    Like

Leave a reply or question

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s