Get the full URL for a NewsItem?

Posted by Community Admin on 04-Aug-2018 02:44

Get the full URL for a NewsItem?

All Replies

Posted by Community Admin on 17-Dec-2013 00:00

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;

Any ideas?

Posted by Community Admin on 19-Dec-2013 00:00

Hello Nick,

Thank you for contacting Telerik Support.

There is an easy way to get newsItem's full URL :

SystemManager.GetContentLocationService().GetItemDefaultLocation(newsItem)
.ItemAbsoluteUrl

 You need to add using Telerik.Sitefinity.Services.

I believe this will help you achieve your goal.

Regards,
Ferdi Nebiev
Telerik
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed