2
我有几个一般链接字段,用作内部链接,所以Sitecore项目。Sitecore 8个简单的方法来获得项目的内部链接?
我需要一个“目标”项目在我的代码,我有我的一个可怕的复杂的方式做这件事的感受:
LinkField lf = myItem.Fields["My Link"];
if (lf != null)
{
if (lf.Value != null)
{
ID targetID;
if (ID.TryParse(lf.Value, out targetID))
{
Item targetItem = Sitecore.Context.Database.GetItem(targetID);
{
if (targetItem != null)
{
// go on with code
}
}
}
}
}
是否有人知道一个更简单的方法来获得这个目标项目?
问候
由于马立克,这很容易:) – Bgl86
@ Bgl86很高兴我能帮助:) –
马立克嗨。我刚刚测试过它,现在正在工作。 TargetItem为空。只有价值财产具有项目Guid。我正在使用DropTree作为字段 – Bgl86