string camlQuery = @" <Query> <Where> <Eq> <FieldRef Name = 'Title' /> <Value Type='Text'>" + chosenIndex + @"</Value> </Eq> </Where> </Query>"; SPListItemCollection items = myList.GetItems(camlQuery);
Seems simple, enough - Right?
Not quite...
Turns out, if you include the <Query> tags in your CAML Query, the entire thing gets blatantly ignored! No errors - It just selects everything o_O
To fix this problem, simply remove the <Query></Query> tags from your statement, and everything will work as planned...
Note: Thanks to manoli.net for the formatting code :D