Access i like items for a user in sharePoint 2010 Programmatically

Here is a short example on how to retrie "i like" items for a given user in SharePoint 2010

public static List GetMyILikeIts()
{

SPServiceContext context = SPServiceContext.GetContext(SPServiceApplicationProxyGroup.Default,SPSiteSubscriptionIdentifier.Default);

UserProfileManager upm = new UserProfileManager(context, true);
UserProfile up = upm.GetUserProfile("Domain\\IAttlee");

SocialTagManager stm = new SocialTagManager(context);
SocialTag[] tags = stm.GetTags(up);

if (tags != null)
return tags.Where(t => t.Term.Name == "I like it").ToList();
else
return null;
}

related post : Programmatically retrieve social ratings in sharepoint 2010

0 comments:

Post a Comment

Disclaimer

This is a personal weblog. The opinions expressed here represent my own and not those of my employer or anyone else. Should you have any questions or concerns please e-mail me at sharepointprogrammingblogger@gmail.com .

Copyright (c) 2010 @ myshaepointwork.blogspot.com. All rights are reserved.Do Not Copy.

@ Learning SharePoint.com