在Sitecore 6.5中按ID获取项目

Dhe*_*iri 7 c# sitecore sitecore6

我在Sitecore 6.5上.

下面的代码工作正常,但我不明白如何.该GetItem()方法有六个重载函数,它将字符串值作为项目路径.

在这种情况下,它将id作为字符串并正确返回项目(位置是Sitecore droplink字段).我错过了什么吗?

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

Ruu*_*ier 15

字符串参数GetItem()可以是ID或Path.
两者都有效.

  • Intellisense显示GetItem(字符串路径),但它可以是包含ID或路径的字符串.他们应该将它命名为pathOrId :) (2认同)