I am trying to search for an item in a SharePoint list using SPQuery, but even though the file is there, the result is null.
The code is the following:
var query = new SPQuery();
query.Query = "<Where><Contains><FieldRef Name='Title' /><Value Type='Text'>" + documentTitle + "</Value></Contains></Where>";
SPListItemCollection listItems = web.Lists["ListName"].GetItems(query);
documentTitle is the name of an existing document, and "ListName" is the name of the list in which the item is.
The item is in the list, but the query returns 0 results.
Can anyone help me with this?