Get the full URL for a NewsItem?
I'm trying to create an MVC widget to list news items, so far this is working well. Just stuck on one thing: how can I get the full default URL to a given news item, based on the default priority page I've set under "Pages where NewsItem items are published"?
Currently I'm attempting to do this by getting the DefaultPageId for the NewsItem and then using that page id to get the page node and from there the full url using the GetFullUrl() method. It's when I try to access the DefaultPageId for the NewsItem I get an error:
The multi-part identifier "b.default_page_id" could not be bound.
Statement(s) could not be prepared.
This is my code so far:
var newsItems = App.WorkWith().NewsItems().Get();
var defaultPage = newsItems.FirstOrDefault().DefaultPageId;
Hello Nick,
Thank you for contacting Telerik Support.
There is an easy way to get newsItem's full URL :
SystemManager.GetContentLocationService().GetItemDefaultLocation(newsItem)
.ItemAbsoluteUrl