this documentation(MSDN), "The overloaded GetComments method retrieves all SocialComment objects for a specified URL or user. If you specify a URL, the method returns all social
comments added to that URL by the current user in the current SPServerContext. If you specify a user, the method returns all social comments that the specified user added".
Another solution is to impersonate the SPSite object with an account who has the rights to manage social data.
We can give the permission in Central Administration –> Application Management –> Service Applications –> User Profile Service, then add an account to the Administrators
group. Then use a code like this to get all the comments of the URL:
public int GetNumberOfNewsPageComments
(SPSite currentSite, string pageUrl, int max)
var serviceContext =
var socialCommentManager =
var comments = socialCommentManager
.GetComments(new Uri(pageUrl), max);
if (comments != null)
Microsoft is conducting an online survey to understand your opinion of the Technet Web site. If you choose to participate, the online survey will be presented to you when you leave the Technet Web site.