2

I'm trying to query all items in a meeting workspace list. I'm trying a query I think should work, but still only returns items specific to the instanceID. Is there a different flavor for client side caml?

Here's my JavaScript:

var camlQuery = new SP.CamlQuery();
var viewXML = "<View><Query><Where><IsNotNull><FieldRef Name=\'Registrant\' /></IsNotNull></Where></Query><QueryOptions><MeetingInstanceID>-1</MeetingInstanceID></QueryOptions></View>";
camlQuery.set_viewXml(viewXML);

Thanks for any insight.

2 Answers 2

2

It turns out the QueryOptions element is not used in the CamlQuery object in the client object model. I eventually turned to SPServices. Here is the statement that did the trick for me:

$().SPServices({
  operation: "GetListItems",
  async: false,
  listName: "Registrants",
  CAMLViewFields: "<ViewFields><FieldRef Name=\'Registrant\' /></ViewFields>",
  CAMLQuery: "<Query><Where><Eq><FieldRef Name=\'Registrant\' LookupId=\'TRUE\'/><Value Type=\'Lookup\'>" + cUserId +"</Value></Eq></Where></Query>",
  CAMLQueryOptions: "<QueryOptions><MeetingInstanceID>-1</MeetingInstanceID></QueryOptions>",
  completefunc: function(xData,Status){
    regListCount=$(xData.responseXML).SPFilterNode("rs:data").attr("ItemCount");
    regInstanceId=$(xData.responseXML).SPFilterNode("z:row").attr("ows_InstanceID");
    regItemId=parseInt($(xData.responseXML).SPFilterNode("z:row").attr("ows_ID"));
  }
});
0

I don't think the <QueryOptions> element is supported in the Client Object Model.

For your requirement, if you want to get all the items in a list, you can use the follwing code:

var camlQuery = new SP.CamlQuery.CreateAllItemsQuery();

You don't need to specify the viewXml explicitly in this case.

1
  • Unfortunately, this doesn't seem to work with meeting workspaces. All queries are automatically filtered by InstanceID. I'm not really looking for an all items query, but just a way to defeat the instanceID filtering. It's looking like I'll have to use the Lists web service. Mar 14, 2012 at 13:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.