我试图访问SharePoint列表,并返回日历日期自定义网页组件我做了。这是工作的罚款,然后我决定只检索选择,而不是整个日历上的日期,所以我想添加一个where子句。CAML查询肥皂的SharePoint
我试过 'YYYY-MM-DD', 'YYYY-MM-DDTHH:MM:SSZ' 和 'YYYY-MM-DD HH:MM:SSZ' 作为字符串格式 我也试过MM/dd/yyyy作为日期格式。
我使用jQuery,和我有在日历列表中的项目。我假设我的日期不是正确的格式。
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>";
如果我把where子句取出,我会收到日历中的所有项目。如果查询在那里,我没有收到任何结果。
在此先感谢
工作代码:
var sharepointDate = Date.parse(date).toString('yyyy-MM-dd');
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><Eq><FieldRef Name='EventDate' /><Value Type='DateTime' IncludeTimeValue='False'>" + sharepointDate + "</Value></Eq></Where></Query></query>\
<rowLimit>1500</rowLimit> \
</GetListItems> \
</soapenv:Body> \
</soapenv:Envelope>";
添加上述工作的代码。谢谢你的帮助 –