IMPORTANT: This version of Sitefinity CMS is out of support and the respective product documentation is no longer maintained and can be outdated. Use the version selector to view a supported product version.
You can get an item's default location by using the overloads of GetItemDefaultLocation method in one of the following ways.
PREREQUISITES: The default location of an item must be a page that is accessible by all users, that is, they have permissions to view it.
To do this, you use the GetItemDefaultLocation(Type itemType, string itemProvider, Guid itemId, CultureInfo culture = null) overload. This overload gets the default (canonical) location by specifying the item type, the item’s provider, and the item ID. This method is useful when you have no reference to the actual content item. It returns an IContentItemLocation item that contains the following information:
If there is no location where an item can be opened, the method returns null.
The following code sample gets the default location of a news item:
To do this, you use the GetItemDefaultLocation(IDataItem item, CultureInfo culture = null) overload.
This overload gets the default (canonical) location of type IContentItemLocation, where the specified IDataItem can be opened. This method can be used when there is a reference to the actual content item. It returns an IContentItemLocation item or null if there is no location for item of that type, provider, and language (for multilingual).
Back To Top
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important