Get item by ID in Sitecore 6.5

Dheeraj Palagiri picture Dheeraj Palagiri · Oct 21, 2014 · Viewed 17.8k times · Source

I am on Sitecore 6.5.

The below code is working fine but I don't understand how. The GetItem() method has six overload functions where it takes string values as just item paths.

In this case it's taking in an id as a string and correctly returning the item (the location is Sitecore droplink field). Am I missing something?

private Sitecore.Data.Items.Item LocationItem
{
    get
    {
        return Sitecore.Context.Database.GetItem(Item["Location"]);
    }
}

Answer

Ruud van Falier picture Ruud van Falier · Oct 21, 2014

The string parameter for GetItem() can be an ID or a Path.
Both will work.