Sitecore 5.0 API

ItemRecords.GetItem Method (DataUri)

Gets an item.

[Visual Basic]
Overloads Public Function GetItem( _
   ByVal uri As DataUri _
) As Item
[C#]
public Item GetItem(
   DataUri uri
);

Parameters

uri
URI.

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.

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.GetItem(itemID, itemLanguage, itemVersion);
  }

  return null;
}

See Also

ItemRecords Class | Sitecore.Data Namespace | ItemRecords.GetItem Overload List