Sitecore 5.0 API

ItemPath.ContentPath Property

Gets the content path.

[Visual Basic]
Public ReadOnly Property ContentPath As String
[C#]
public string ContentPath {get;}

Remarks

If the item is a descendant of /sitecore/content, the path relative to "/sitecore/content" is returned with a slash '/' prepended. If not, the absolute path is returned.

Example

The following example determines if an item is located in the News section.

{{
public bool IsLayoutItem(Item item) {
  if (item != null) {
    string path = item.Paths.ContentPath;
    return path.StartsWith("/Home/News");
  }
  return false;
}
}}

See Also

ItemPath Class | Sitecore.Data Namespace