Possible errror is SPServices 'GetListItems'

Sep 30, 2009 at 8:29 PM

My GetListItems web service call no longer works when I change the FieldRef Name value in the CAMLQuery parameter to one with spaces in the name. 

The following works:

$().SPServices({
            operation:'GetListItems',
            listName:'quoteoftheday',
            CAMLViewFields:'<ViewFields><FieldRef Name="Title"/><FieldRef Name="Created"/></ViewFields>',
            CAMLQuery:'<Query><Where><Eq><FieldRef Name="Created"/><Value Type="DateTime"><Today /></Value></Eq></Where></Query>',
            CAMLRowLimit:10,
            CAMLQueryOptions:'<QueryOptions><IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns></QueryOptions>',    
            completefunc: function (xData,Status){
                $(xData.responseXML).find('z\\:row').each(function(){

 

The following fails:

$().SPServices({
            operation:'GetListItems',
            listName:'quoteoftheday',
            CAMLViewFields:'<ViewFields><FieldRef Name="Title"/><FieldRef Name="Created"/></ViewFields>',
            CAMLQuery:'<Query><Where><Eq><FieldRef Name="Expire Date"/><Value Type="DateTime"><Today /></Value></Eq></Where></Query>',
            CAMLRowLimit:10,
            CAMLQueryOptions:'<QueryOptions><IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns></QueryOptions>',    
            completefunc: function (xData,Status){
                $(xData.responseXML).find('z\\:row').each(function(){

 

Both columns are of the same type, 'datetime'. Can you help verify my findings.

Thanks

Marcus

 

 

Coordinator
Sep 30, 2009 at 8:42 PM

Marcus:

You need to use the internal names for the columns in your CAML.  so, in this case, it would be:

CAMLQuery:'<Query><Where><Eq><FieldRef Name="Expire_x0020_Date"/><Value Type="DateTime"><Today /></Value></Eq></Where></Query>',

M.

Oct 1, 2009 at 1:23 PM

Thanks everything is working.

 

Coordinator
Oct 1, 2009 at 1:24 PM

Good to hear!  Let me know if you have any other isssues.

M.