You can get the item locations when you do not have the data item, but you know its details - ID, Type, ProviderName. In this case, you can use the overload of the GetItemLocations() method that takes as parameters the content item’s Type, ProviderName, ID, and Culture (for multilingual) and returns an enumeration of IContentItemLocation objects. These are all the locations where the specified item can be opened. If there is no location, the GetItemLocations() method returns an empty collection.
The following code sample gets all locations of a news item by its ID:
You can get the item locations when you have a reference to the item. In this case, you use the GetItemLocations(IDataItem item, CultureInfo culture = null) overload that takes as parameter the actual IDataItem and as optional parameter - the desired culture. It returns an enumeration of IContentItemLocation objects. If there are no locations, it returns an empty collection.
The following code sample gets all locations where a news item is published:
Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.
This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.
This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.
The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important