I hope everyone had a great holiday season! … I certainly did and you can tell by a “post-break” on my blog.
One of the great little features I recently looked into is SharePoint 2010 Social Data feature. It’s actually a collection of features and supporting classes, objects etc; more on that topic below.
Here is the scenario: You have an intranet where you really want to help you users decide which content is important to them and which is not. You also want to engage your users on the process of making the decision on the content importance. You can use Social Data and tagging feature in SharePoint 2010 to either promote the content – let’s say a forum topic – or demote it. That way naturally the important content would bubble it’s way up to the top and not so importnant would not. This is a great way to manage not only forum type content, you can prioritize many other pieces of information and until recently only large companies were able to spend on developing propriatory mechanisms to do so
To create you promote/demote content prototype we’ll do the following:
1. Ensure you have a Metadata Management Service up and running over here: http://[central admin host & port]/_admin/ServiceApplications.aspx
2. Create keywords that will mark our content to be promoted or demoted
3. Use a console SharePoint 2010 application with Visual Stusio 2010 with the following code:
SPSite siteColl = SPContext.Current.Site;
SPServiceContext serviceContext = SPServiceContext.GetContext(siteColl);
SocialTagManager mySocialTagManager = new SocialTagManager(serviceContext);SocialTerm[] socTerms = mySocialTagManager.GetAllTerms();
IEnumerable<SocialTerm> termQuery = socTerms.Where(socTerm =>
(
socTerm.Term.Name.Equals(TagType.Promote.ToString()) ||
socTerm.Term.Name.Equals(TagType.Demote.ToString())
));int promoted = 0;
int demoted = 0;
int index = 0;
Term[] taxTerms = new Term[2];foreach (SocialTerm aTerm in termQuery)
{
taxTerms[index++] = aTerm.Term;
}SocialTag[] socTags = mySocialTagManager.GetTags(taxTerms, 0);
IEnumerable<SocialTag> tagQuery = socTags.Where(socTag => socTag.Url.Equals(HttpContext.Current.Request.Url));foreach (SocialTag tag in tagQuery)
{
string termName = tag.Term.Name;
if (termName.Equals(TagType.Promote.ToString()))
{
promoted++;
}
else if (termName.Equals(TagType.Demote.ToString()))
{
demoted++;
}
}
rank.Text = (promoted – demoted).ToString();
Here our rank label will contain the value denoting the difference between votes to promote certain content or demote it.
We can package our solution as a webpart and have it displayed on pages of our relevant content.
Enjoy!