I have a sharepoint list which has several fields. It seems that when a field is left blank on one of the records - that attribute is missing on the field when I query the list using a CAML Query.
Is it possible to write a query to return the records which do not contain this attribue?
Example:
id Employee Title description
-------------------------
1 Jeff Person1
2 Bob Person2
3 Charles Person3
4 Person4
5 Person5
Is there any way to query this to only return records with id 4 and 5 because they have left the name field blank?
I tried the following:
System.Text.StringBuilder xmlQuery = new StringBuilder();
xmlQuery.Append("<Query>");
xmlQuery.Append(" <Where>");
xmlQuery.Append(" <IsNull>");
xmlQuery.Append(" <FieldRef Name=\"Employee Title\" />");
xmlQuery.Append(" </IsNull>"); xmlQuery.Append(" </Where>");
xmlQuery.Append("</Query>"); XmlNode query = new XmlDocument();
query.InnerXml = xmlQuery.ToString();
But of course the attribute doesn't exist in those records, so nothing is returned
Thanks in advance!
Edit
The query works after replacing any spaces in the Name
with x0020
xmlQuery.Append(" <FieldRef Name=\"Employee_x0020_Title\" />");