0

I got strange sharepoint exception with empty message when trying to get items by query:

<Where>
<Eq>
<FieldRef Name='Taxonomy' LookupId='TRUE' /><Value Type='Lookup'>-1</Value>
</Eq>
</Where>
<OrderBy>
<FieldRef Name='Title' Ascending='True'/>
</OrderBy>

enter image description here Whats wrong with me query?

P.S. -1 means that by user was selected invalid tag and nothing should be selected. And i dont have access to other code to write 'if' i can only override current query.

Ievgen
  • 4,261
  • 7
  • 75
  • 124

1 Answers1

1

I ran this on my environment and it looks like the problem is the -1 is not considered valid input. It looks like the valid range is integers from 0-int.MaxValue.

You can make a query that is always false (the field is null AND not null, for example), or, if the only thing you can control is the number you could try 2147483647 (int.MaxValue) instead, which is highly unlikely to be a valid value.

lgaud
  • 2,430
  • 20
  • 30
  • 1
    Looks like 0 may also work as an "invalid" value as the index is assigned starting from 1. – lgaud Oct 02 '12 at 20:24