SharePoint CAML OrderBy 修改后不起作用
我已经对列表进行了查询。我想获取满足特定条件的最后修改的项目,我的查询如下所示:
<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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我总是将 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".
如果您在 C# 字符串中执行此操作来获取 SPListItemCollection,则不需要“ ”标签。
If you're doing this in a C# string to get an SPListItemCollection, you don't need "<Query></Query>" tags.