Sitecore 5.0 API

Item.ID Property

Gets the ID of the item.

[Visual Basic]
Public ReadOnly Property ID As ID
[C#]
public Sitecore.Data.ID ID {get;}

Remarks

An ID identifies an object within the system, but not uniquely. The underlying data of an ID is a Guid.

The ID uniquely identifies the item within a database. The item may appear multiple times, but the item is always unique.

Items are usually retrives either by path or by ID. It is much faster to retrieve items by ID than by path. Sitecore defines a number of wellknown IDs for fast retrival.

Example

The following example retrieves the workflow root item, under which workflows are defined.

{{{
public Item GetWorkflowByName(string name) {
  Item root = Sitecore.Context.ContentDatabase.Items[ItemIDs.WorkflowRoot];
  if (root != null)  {
    return root.Children[name];
  }
  return null;
}
}}}

See Also

Item Class | Sitecore.Data.Items Namespace