Skip to content

Instantly share code, notes, and snippets.

@sitefinitySDK
Created September 4, 2013 10:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sitefinitySDK/6435476 to your computer and use it in GitHub Desktop.
Save sitefinitySDK/6435476 to your computer and use it in GitHub Desktop.
SF_10.1, SF_10.2, SF_11.0, SF_11.1, SF_11.2, SF_12.0, SF_12.1, SF_12.2, SF_13.0, SF_13.1, SF_13.2, SF_13.3, SF_14.0, SF_14.1, SF_14.2, SF_14.3 - https://docs.sitefinity.com/for-developers-get-the-default-location-of-an-item
using Telerik.Sitefinity.News.Model;
using Telerik.Sitefinity.Services;
namespace Telerik.Sitefinity.Documentation.CodeSnippets.DevGuide.HowTo.ContentLocationsAPI
{
public partial class ContentLocationsAPI
{
public static string GetItemDefaultLocation(NewsItem item)
{
//first we need to get an instance of the location service
var clService = SystemManager.GetContentLocationService();
//gets the item default location of a given news item
var location = clService.GetItemDefaultLocation(item);
//gets the absolute url for the location
if (location != null)
return location.ItemAbsoluteUrl;
return string.Empty;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment