Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

The following statement returns "Value does not fall within the expected range." when the query argument is filled in. If it is set to null, the call works fine.

XmlElement data = (XmlElement)listsObject.GetListItemChangesSinceToken(listGUID, null, query, viewFields, null, queryOptions, null, contains);

The query argument contains the following code:

<Query>
  <Where>
    <Eq>
      <FieldRef Name="Status" />
      <ValueType Type="Text">Approved</ValueType>
    </Eq>
  </Where>
  <OrderBy>
    <FieldRef Name="Status" />
  </OrderBy>
</Query>

Any idea why this happens?

share|improve this question
    
Did you try it without defining query (pass null)? Column Status is OOTB column or? –  Vedran Rasol Sep 16 '11 at 9:28
add comment

4 Answers 4

Have to tried removing the <Query> tag from the query text? Also, have you tried putting the OrderBy before the Where? Sometimes SharePoint doesn't like queries like that

Have you tried changing the order of the OrderBy and Where tags? According to this blog post and my own personal experience, you should put the OrderBy tag before the Where tag.

share|improve this answer
    
-1 It's webservice so <Query> is needed –  Vedran Rasol Sep 16 '11 at 9:24
    
I don't think I deserve a downvote, maybe the Query is required if you say so, but the order of the CAML query definitely makes a difference: blog.henryong.com/2009/06/29/… The OP posted a query with the OrderBy clause after the Where clause. It's at least worth a try –  soniiic Sep 16 '11 at 10:12
    
Why didn't you included this link in answer? Edit your answer, include link in it and you will receive up vote because you provided useful info. And don't post multiple answers. Edit existing one. Your other answer is more comment then real answer. –  Vedran Rasol Sep 16 '11 at 10:50
    
And yes. If I look at it now it is not a -1 answer. Still it was only answer when I down voted it because it looked that you posted it without thinking and you provided IMO useless info. –  Vedran Rasol Sep 16 '11 at 10:52
add comment

Did you make sure that fields you are using in OrderBy are included in the SPSiteDataQuery.ViewFields property?

If not, could you please paste the whole code?

share|improve this answer
add comment

At Lists.GetListItemChangesSinceToken Method it says:

Note: The GetListItemChangesSinceToken method fails for lists with unique item permissions if the PermMask field is not explicitly requested: <FieldRef Name="PermMask"/>

Could this be your issue?

share|improve this answer
add comment

GetListItemChangesSinceToken MSDN Reference article says:

The query parameter is not intended to be used with the contains parameter.

So, just remove your contains parameter, and it should be ok.

share|improve this answer
    
He's not using contains is he? –  soniiic Sep 16 '11 at 11:32
    
He is. If you would read the question intently, you could notice contains variable passed to GetListItemChangesSinceToken (it is the last one) –  Andrey Markeev Sep 16 '11 at 13:18
    
Oh yes you're right :) –  soniiic Sep 16 '11 at 15:40
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.