Get all the social comments created by the specific user 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 specific user 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="rd\ktzh955"
## $maximumItemsToReturn is used to specify the maximum number of comments to return.
## This value must be null, or nonnegative and less than 1001.
## If null or 0, this method returns up to 1000 social comments
$maximumItemsToReturn=0
## $startIndex is used to specify the zero-based index of the total set of social comments at which the returned set of social comments starts
$startIndex=0
## Web Service Reference - http://Site/_vti_bin/SocialDataService.asmx
$socialDataServiceWebServiceReference = New-WebServiceProxy -Uri $uri -UseDefaultCredential

$SocialCommentDetail=$socialDataServiceWebServiceReference.GetCommentsOfUser($userAccountName,$maximumItemsToReturn,$startIndex)
## $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