SharePoint CAML OrderBy 修改后不起作用

发布于 2024-08-08 13:11:58 字数 557 浏览 5 评论 0原文

我已经对列表进行了查询。我想获取满足特定条件的最后修改的项目,我的查询如下所示:

<Query><OrderBy><FieldRef  Name='Modified' Ascending='FALSE' /></OrderBy><Where><Eq><FieldRef Name='kortnummer'/><Value Type='String'>kv11</Value></Eq></Where></Query>

我获得了我需要的列表项,只是顺序不正确。将 Ascending 更改为 true 没有任何作用,因此显然 OrderBy 子句有一些不正确的地方。

根据 MSDN 应该可以通过 Modified 来订购。

知道为什么我的 OrderBy 不起作用吗?

I have made a query against a list. I want to get the last modified item which meets a certain condition, and my query looks like this:

<Query><OrderBy><FieldRef  Name='Modified' Ascending='FALSE' /></OrderBy><Where><Eq><FieldRef Name='kortnummer'/><Value Type='String'>kv11</Value></Eq></Where></Query>

I get the listitems i need, just not in the right order. Changing Ascending to true does nothing, so obviously there is something with the OrderBy clause that is not right..

According to MSDN it should be possible to order by Modified.

Any idea why my OrderBy does not work?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

过期以后 2024-08-15 13:11:58

我总是将 OrderBy 放在Where 之后

否则,您可以确保您使用的是内部名称。我通常使用 SharePoint Manager 2007 来获取内部字段名称。 Codeplex SharePoint 管理器

我可以看到,在我的 SharePoint 列表中,修改后的列内部名称为“Last_x0020_Modified” ”。

I always put the OrderBy after the Where.

Otherwise you could make sure that you are using the internal name. I usually use SharePoint Manager 2007 to get the internal field names. Codeplex SharePoint manager

I can see that on a list in my SharePoint, the modified column internal name is "Last_x0020_Modified".

诗酒趁年少 2024-08-15 13:11:58

如果您在 C# 字符串中执行此操作来获取 SPListItemCollection,则不需要“”标签。

If you're doing this in a C# string to get an SPListItemCollection, you don't need "<Query></Query>" tags.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文