Get all the social comments created by the specified user for the specified URL using SharePoint 2010 web service in powershell

Steps Involved:
  1. Open SharePoint 2010 Management Shell by going to Start | All Programs | SharePoint | Microsoft SharePoint 2010 Products | SharePoint 2010 Management Shell (Run as Administrator).
  2. Run the following script.

Powershell Script:

 
##Get all the social comments created by the specified user for the specified URL using SharePoint 2010 web service in powershell
$uri="http://serverName:10736/sites/ECT/_vti_bin/SocialDataService.asmx?wsdl"
## $userAccountName is a string that contains the specific account name
$userAccountName="domainName\userName"

## $url is a string that contains the URL for which social comments has to be retrieved
$url="http://serverName:10736/sites/ECT/"
## Web Service Reference - http://Site/_vti_bin/SocialDataService.asmx
$socialDataServiceWebServiceReference = New-WebServiceProxy -Uri $uri -UseDefaultCredential

$SocialCommentDetail=$socialDataServiceWebServiceReference.GetCommentsOfUserOnUrl($userAccountName,$url)
## $SocialCommentDetail is of Type: [SocialDataService Web service].SocialCommentDetail()
##[SocialDataService Web service].SocialCommentDetail() - Refer http://msdn.microsoft.com/en-us/library/websvcsocialdataservice.socialcommentdetail_members.aspx


foreach($comment in $SocialCommentDetail)
{
write-host -ForegroundColor Green "Social Comment : " $comment.Comment
write-host -ForegroundColor Green "-----------------------------------"
## SocialCommentDetail.Comment property is used to get the body of the social comment.
write-host -ForegroundColor Yellow "Comment : " $comment.Comment
## SocialCommentDetail.IsHighPriority property is used to indicate the priority level of the social comment.
write-host -ForegroundColor Yellow "IsHighPriority : " $comment.IsHighPriority
## SocialCommentDetail.Url property is used to get the URL to the social data.
write-host -ForegroundColor Yellow "Url : " $comment.Url
## SocialCommentDetail.Owner property is used to get the user associated with the social data.
write-host -ForegroundColor Yellow "Owner : " $comment.Owner
## SocialCommentDetail.LastModifiedTime property is used to get date and time when the social data was last modified.
write-host -ForegroundColor Yellow "LastModifiedTime : " $comment.LastModifiedTime
## SocialCommentDetail.Title property is used to get the title of the social data.
write-host -ForegroundColor Yellow "Title : " $comment.Title
}



Output:


output.jpg





Ebook Download
View all
Learn
View all