2

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?

1
  • Did you try it without defining query (pass null)? Column Status is OOTB column or? Sep 16, 2011 at 9:28

4 Answers 4

2

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.

4
  • -1 It's webservice so <Query> is needed Sep 16, 2011 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, 2011 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. Sep 16, 2011 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. Sep 16, 2011 at 10:52
1

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?

0

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?

0

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.

3
  • He's not using contains is he?
    – soniiic
    Sep 16, 2011 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) Sep 16, 2011 at 13:18
  • Oh yes you're right :)
    – soniiic
    Sep 16, 2011 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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