CAML query soap SharePoint
Posted
by
robScott
on Stack Overflow
See other posts from Stack Overflow
or by robScott
Published on 2012-06-08T20:48:31Z
Indexed on
2012/06/10
10:40 UTC
Read the original article
Hit count: 205
sharepoint
|soap
I'm trying to access a SharePoint list and return the calendar dates for a custom webpart I made. It was working fine, then I decided to only retrieve the date selected rather than the whole calendar, so I wanted to add a where clause.
I've tried 'yyyy-MM-dd', 'yyyy-MM-ddThh:mm:ssZ', and 'yyyy-MM-dd hh:mm:ssZ' as string formats I've also tried MM/dd/yyyy as a date format.
I'm using jQuery, and I do have list items in the calendar. I'm assuming my date is not in the correct format.
var date = $(this).attr('date');
var sharepointDate = Date.parse(date).toString('yyyy-mm-ddT00:00:01Z');
var soapEnv =
"<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
<soapenv:Body> \
<GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
<listName>CorporateCalendar</listName> \
<viewFields> \
<ViewFields> \
<FieldRef Name='Title' /> \
</ViewFields> \
</viewFields> \
<query><Query><Where><Geq><FieldRef Name='EventDate' /><Value Type='DateTime'>" + sharepointDate + "</Value></Geq></Where></Query></query> \
<rowLimit>500</rowLimit> \
</GetListItems> \
</soapenv:Body> \
</soapenv:Envelope>";
If I take the where clause out I receive all the items in the calendar. If the query is in there, I receive no results.
Thanks in advance
© Stack Overflow or respective owner