开发者

SharePoint CAML OrderBy Modified does not work

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 lik开发者_Python百科e 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?


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".


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜