i have a problem with a CAML Query for a Sharepoint Online(Office365) Calendar. I try to get all Calendar Appointments between two dates. Here is my code:
private void getFreeDays()
{
List urlaubskalender = clientContext.Web.Lists.GetByTitle("Urlaubskalender");
DateTime startDate = Convert.ToDateTime(dpEventDate.SelectedDate);
DateTime endDate = Convert.ToDateTime(dpEndDate.SelectedDate);
CamlQuery getDatesQuery =new CamlQuery();
getDatesQuery.ViewXml = "<Query>"+
"<Where>"+
"<And>"+
"<Geq>"+
"<FieldRef Name='EventDate' />"+
"<Value Type='DateTime'>"+startDate+"</Value>"+
"</Geq>"+
"<Leq>"+
"<FieldRef Name='EndDate' />"+
"<Value Type='DateTime'>"+endDate+"</Value>"+
"</Leq>"+
"</And>"+
"</Where>"+
"</Query>";
eventCollection = urlaubskalender.GetItems(getDatesQuery);
clientContext.Load(eventCollection);
clientContext.ExecuteQueryAsync(new ClientRequestSucceededEventHandler(onQSGetEvents), null);
}
The Problem is that I get appointments from 01.01.2013 when I select 01.02.2013 as EventDate and 08.02.2013 as EndDate. The appointment is a reccurent one, maybe this is the cause of the problem? I tried to find some informations to create a CAML Query without recurring appointment but i couldn't found something. Maybe the failure is something total different...
I hope someone can help me...and sorry for my bad english, i gave my best ;)