gpt4 book ai didi

asp.net - Sitecore:按字段选择项目:TreelistEx

转载 作者:行者123 更新时间:2023-12-02 10:04:27 24 4
gpt4 key购买 nike

我有名为 MyItems 的 Sitecore 文件夹,其中包含 MyItem 类型的项目。我需要使用 sitecore 查询或 xpath 从 .net 代码查询项目。 MyItem 具有 TreelistEx 类型的字段 MyField。我需要选择 MyField 包含“thevalue”(其他项目的 GUID)的所有项目。我该怎么做?

非常感谢

最佳答案

string query = string.Format("/sitecore/content/MyItems/*[contains(@MyField,'{0}')]", thevalue);
Item[] myItems = Sitecore.Context.Database.SelectItems(query);

我刚刚从我的网站中提取了此代码并调整了您的查询的名称。如果您有很多 MyItems,那么效率相当低,因此我不会在性能至关重要的页面上使用它。相同的查询应该适用于任何列表类型字段。

关于asp.net - Sitecore:按字段选择项目:TreelistEx,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6536201/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com