Replace Program.cs with the following code
snippet.
namespace
GetallSocialTags
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Office.Server.SocialData;
using Microsoft.SharePoint;
public class
Program
{
public
static void Main(string[]
args)
{
//// Uri - required to get all the social tags for
the specified uri
Uri uri =
new Uri("https://servername.com/finance/Finance/");
using (SPSite
site = new
SPSite("https://servername.com/finance/Finance/"))
{
//// Get the context of the
service application
SPServiceContext
context = SPServiceContext.GetContext(site);
//// SocialTagManager - Contains
methods and properties used to manipulate social tag data
SocialTagManager
socialTagManager = new
SocialTagManager(context);
//// GetTags(Uri) method is used
to retrieve an array of SocialTag objects that are owned by the current user
and that contain the specified URL.
SocialTag[] tags =
socialTagManager.GetTags(uri);
Console.WriteLine("Tags
for the URL: " + uri.AbsoluteUri);
foreach (SocialTag
tag in tags)|
{
Console.WriteLine("###############################################");
Console.WriteLine("
Tag Name : " + tag.Term.Name);
Console.WriteLine("
URL : " + tag.Url.AbsoluteUri);
Console.WriteLine("
Title : " + tag.Title);
Console.WriteLine("
Owner : " + tag.Owner.DisplayName);
}
Console.ReadLine();
}
}
}
}