質問

I am not sure if this is the correct way of defining two orderby's in the query as I could not find the documentation regarding this issue. Nor did this work as expected for me.

I am trying this:

 var query = "<Query><OrderBy><FieldRef Name='Number' Ascending='true' /><FieldRef Name='Number' Ascending='true' /></OrderBy></Query>";
役に立ちましたか?

解決

A quick search took me to this page: OrderBy Element (Query)

<OrderBy>
  <FieldRef Name="Newcomers"/>
  <FieldRef Name="Years" Ascending="FALSE"/>
  <FieldRef Name="Location"/>
</OrderBy>

All I can say is that you're doing what the documentation shows. Have a poke around over there yourself - I can safely say you have more experience than I do with SharePoint Services.

Edit: I doubt this makes a difference, but try defining your query like this:

var query = '<Query><OrderBy><FieldRef Name="Number" Ascending="TRUE" /><FieldRef Name="Number" Ascending="TRUE" /></OrderBy></Query>';

I just swapped the apostrophe string declaration around to use double quotes, and the case of true to TRUE.

他のヒント

You can use U2U to build all the CAML for you. I use it for all my SharePoint query building for free.

http://www.u2u.be/res/tools/camlquerybuilder.aspx

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top