Sitecore 5.0 API

Database.Items Property

Retrieves items from the database.

[Visual Basic]
Public ReadOnly Property Items As ItemRecords
[C#]
public ItemRecords Items {get;}

Remarks

An item is a record in a database. Items are the basic building block of a Sitecore site. An item may represent any kind of information, e.g. a piece of content, a media file, a layout etc. Items always have a name and and ID that uniquely identifies the item within the database. Items have a template that defines which fields the item contains. An item represent a single version of piece of content is a single language.

An item can be retrieved by its unique ID, its path, e.g. "/sitecore/content/Home", its long ID which is a path of IDs or its URI. If the language not specified, the item is retrieved in the current language. If the version is not specified, the latest version is retrieved.

Example

This example gets an item in a database.

public Item GetItem(string databaseName, string id, string language, string version) {
  ID itemID = ID.Parse(id);

  Language itemLanguage = Language.Parse(language);
  
  Sitecore.Data.Version itemVersion = Sitecore.Data.Version.Parse(version);

  Database database = Factory.GetDatabase(databaseName);

  if (database != null) {
    return database.Items[itemID, itemLanguage, itemVersion];
  }

  return null;
}

See Also

Database Class | Sitecore.Data Namespace