Contains utility properties and function that describe the path of an item.
For a list of all members of this type, see ItemPath Members.
System.Object
Sitecore.Data.ItemPath
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.
A path identifies an item. A path can be an ID or a sequence of item names or IDs. If a path starts with a slash (/) it is an absolute path that is resolved from the root element of the database. If not, it is a relative path that is resolved from the current context item.
The path of the item can be retrieved using the Path property. This returns the path in the format "/sitecore/content/Home".
To get the path relative to the content item, use the ContentPath. If the item is not a descendant of the content item, the full path is returned. To see if the item is a descendant of the content item, use the IsContentItem property.
The MediaPath returns the path relative to the media library root item. If the item is not a media item, the full path is returned. To see if the item is a located within the media library, use the IsMediaItem property.
Other items relative to this item can be retrieved using the GetItem and GetSubItem methods.
To test if another item is an ancestor of this item, use the IsAncestorOf method.
The following example determines if an item is a layout.
{{
public bool IsLayoutItem(Item item) {
if (item != null) {
string path = item.Paths.Path;
return path.StartsWith("/sitecore/layout");
}
return false;
}
}}
Namespace: Sitecore.Data
Assembly: Sitecore.Kernel (in Sitecore.Kernel.dll)
ItemPath Members | Sitecore.Data Namespace