Wednesday, October 19, 2011

Sharepoint 2010 Social Features:Tag Cloud By AccountName

In OOB tag cloud, we get tag cloud only by Current user or By All tags.
To Customize tag cloud by accountname or profile ,
1. Add the reference of /_layouts/1033/styles/socialdata.css in page layouts or masterpage.

2. Add dll reference C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI\microsoft.sharepoint.portal.dll
3. In Visual studio, Right click solutionAdd service reference click on ‘Advanced’ buttonAdd web referenceclick link Web services on local machine.
4. Search for socialdataservice.asmx.

public class TagWP : WebPart

localhost.SocialTermDetail[] details;

localhost.SocialDataService objSocialDataService = null;

long tagCount = 0;

protected override void CreateChildControls()


objSocialDataService = new localhost.SocialDataService();

int maximuItems=10;
int intstartIndex=1;
objSocialDataService.Credentials = System.Net.CredentialCache.DefaultCredentials;
string accountname= SPHttpUtility.HtmlEncode(Context.Request.QueryString["accountname"]);
details = objSocialDataService.GetTagTermsOfUser(accountname, maximuItems);
protected override void Render(System.Web.UI.HtmlTextWriter writer)

writer.Write("DIV id='tagCloudDatatagCloudByProfile' class='ms-TagCloud ms-TagCloudLink


writer.Write("DIV id='tagCloudByProfile'


No comments: