Sitefinity CMS enables you to query for specific comments.
When querying for specific comment by its Key, you perform the following:
var cs = SystemManager.GetCommentsService();
var commentFilter =
var comment = cs.GetComments(commentFilter).SingleOrDefault();
When querying all blog post comments by the Id of the live version of the blog post item, you must perform the following:
var filter =
//gets the thread related to the blog post
var language = Thread.CurrentThread.CurrentUICulture.Name;
var threadKey = ControlUtilities.GetLocalizedKey(blogPostId, language);
You can also use CommentFilter to filter comments by different criteria, each one represented as a list:
In this example, you filter by more than one criteria. To find all comments for News with status Spam, perform the following:
var comments = cs.GetComments(commentFilter);
If the method does not find any comments matching the filter criteria, the system returns null as a result.
Following is a full code snipped:
Back To Top