Social Tag can be created for any specified URL with a valid term using SocialTagManager object. SocialTagManager object contains methods and properties that are used to manipulate social tag data. Here we will be seeing how to get all the social tags for the specified URL in SharePoint 2010 using Powershell. View all the social tags for the specified URL through Central Administration:
Automation: Get all the Social Tags in SharePoint 2010 using PowerShell Steps Involved:
CreateSocialTag.xml <?xml version="1.0" encoding="utf-8" ?> <SocialTag> <SiteURL> https://serverName.com/Finance/Finance/</SiteURL> <Uri>https://serverName.com/Finance/Finance/</Uri> </SocialTag> CreateSocialTag.ps1 ## ------------------------------------------------------------------- ## Powershell script for retrieving Social Tag for the specified URL ## Note : Need to update the XML file path before running the script. ## Author : Vijai Anand Ramalingam ## Date : 28-Oct-2011 ## ------------------------------------------------------------------- #----------------Get the xml file--------------------------------------------------------------- [xml]$xmlData=Get-Content "D:\VijaiPOC\RetrieveSocialTag.xml" #----------------Retrieve Social Tag function---------------------------------------------------- function RetrieveSocialTag() { $uri = New-Object System.Uri($xmlData.SocialTag.Uri); $site = Get-SPSite $xmlData.SocialTag.SiteURL
## Get the context of the service application $context = Get-SPServiceContext($site) ## SocialTagManager - Contains methods and properties used to manipulate social tag data $socialTagManager = New-Object -TypeName Microsoft.Office.Server.SocialData.SocialTagManager -ArgumentList $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. [Microsoft.Office.Server.SocialData.SocialTag[]]$tags = $socialTagManager.GetTags($uri) Write-Host -ForegroundColor Green "Tags for the URL: " $uri.AbsoluteUri foreach ($tag in $tags) { Write-Host -ForegroundColor Magenta "###############################################" Write-Host -ForegroundColor Yellow " Tag Name : " $tag.Term.Name Write-Host -ForegroundColor Yellow " URL : " $tag.Url.AbsoluteUri Write-Host -ForegroundColor Yellow " Title : " $tag.Title Write-Host -ForegroundColor Yellow " Owner : " $tag.Owner.DisplayNam } ## Dispose the site object $site.Dispose() } #----------------Calling the function------------------------------------------------------------ RetrieveSocialTag Run the Script:
Thus in this article we have seen how to get all the social tags using powershell in SharePoint 2010.
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: