NewsItems and Comments
I am attempting to get a listing of all of the published NewsItems and the comments that have been posted in regards to them. I am returning all of the published NewsItems with the code below. However when I loop through the NewsItems the Comments.Count for the items are always zero. I have verified that there are many NewsItems that have published comments.
As a side note I have also italicized and bolded a typo I have found when using the fluent API
Thanks,
Tony Concialdi
Public Shared Function GetAllNewsFluent() As IQueryable(Of NewsItem)
Return App.WorkWith().NewsItems().Publihed().[Get]()
End Function
Dim AllSitefinityNewsItems = GetAllNewsFluent()
For Each item As NewsItem In AllSitefinityNewsItems
Dim curNewsLink As New NewsLink
curNewsLink.strURL = item.Urls(0).Url
curNewsLink.intShares = item.Comments.Count
If curNewsLink.intShares > 0 Then
NewsList.Add(curNewsLink)
End If
Next
Hi Tony,
Please find attached a sample template which counts the number of comments for blog post programatically and displays them in a Literal control on the frontend, I hope you find it useful.