I'm trying to retrieve a list of items where a specific field matches a specific value. There is likely going to be multiple items returned when the query is successful.
Here's what my CAML query looks like:
//init the query object
itemQuery = new SP.CamlQuery();
//build the query string
//Equiv to SELECT * FROM list WHERE CollectiveNum = strCollectiveNum (parameter)
itemQueryString = '<Where>';
itemQueryString +='<Eq><FieldRef Name=\'Collective #\'/><Value Type=\'Lookup\'>' + strCollectiveNum + '</Value></Eq>';
itemQueryString +='</Where>';
itemQuery.getitems(itemQuery);
No matter what this query returns all items! I'm confused. It's really unclear to me why this would be so.
Next, If I follow the example in the section "Retrieving Items from a List Using Javascript" on this page by adding
<View><Query>
and
</Query></View>
around my query string it throws an alert with a message that says "Request failed. One or more field types are not installed properly. Go to the list settings to delete these fields. undefined"
Where am I going wrong? I'd be glad to post any other pieces of my script if needed.