本文介绍了如何从Sharepoint日历中获取两个日期之间的事件列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在sharepoint中有一个日历,现在我希望得到两个日期之间的事件..
但我的代码不起作用!
I have a calendar in sharepoint,now i want get events of between two date..
but My code does not work!
DateTime startDate = faDatePicker1.SelectedDateTime;
DateTime EndDate = faDatePicker2.SelectedDateTime;
using (ClientContext context = new ClientContext(siteUrl))
{
context.Credentials = new NetworkCredential(Properties.Settings.Default.Username, "123", "mesbahsoft.local");
List oList = context.Web.Lists.GetByTitle("Vacation");
CamlQuery camlQuery = new CamlQuery();
camlQuery.ViewXml = "<query><Where><Geq><FieldRef Name='EventDate' /><Value Type='DateTime'>" + startDate + "</Value>" +
"</Geq><Leq><FieldRef Name='EventDate' /><Value Type='DateTime'>" + EndDate + "</Value></Leq><And><Geq><FieldRef Name='EndDate' /><Value Type='DateTime'>" + startDate + "</Value></Geq><Leq><FieldRef Name='EndDate' /><Value Type='DateTime'>" + EndDate + "</Value></Leq></Where></query>";
ListItemCollection collListItem = oList.GetItems(camlQuery);
context.Load(collListItem);
context.ExecuteQuery();
}
推荐答案
这篇关于如何从Sharepoint日历中获取两个日期之间的事件列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!