I am trying to create event for all day using o365 event rest api but getting error start and end time should be midnight I tried using below start date & End date for all day event e.g. Start Date: 01/01/2016 12:00 AM (dd/MM/yyyy) End Date: 02/01/2016 12:00 AM (dd/MM/yyyy) As api says there should be 24 hours gap for all day event I did the same way still its throwing error.
I tried different case for creating event but there is difference between the dates which I passed to rest api, I tried with passing time zone too but still there is difference.
using API 2.0 getting differnt issue. Incompatible type kinds were found. The type 'Microsoft.OutlookServices.DateTimeTimeZone' was found to be of kind 'Complex' instead of the expected kind 'Primitive'.
var startDt=new DateTime(2016, 1, 22, 00, 00, 0);
startDate.DateTime = startDt.ToString(dateTimeFormat);
startDate.TimeZone = timeZone;
DateTimeTimeZone endDate = new DateTimeTimeZone();
endDate.DateTime = startDt.AddDays(1).ToString(dateTimeFormat);
endDate.TimeZone = timeZone;
Event newEvent = new Event
{
Subject = "Test Event",
Location = location,
Start = startDate,
End = endDate,
Body = body
};
try
{
// Make sure we have a reference to the Outlook Services client
var outlookServicesClient = await AuthenticationHelper.EnsureOutlookServicesClientCreatedAsync("Calendar");
// This results in a call to the service.
await outlookServicesClient.Me.Events.AddEventAsync(newEvent);
await ((IEventFetcher)newEvent).ExecuteAsync();
newEventId = newEvent.Id;
}
catch (Exception e)
{
throw new Exception("We could not create your calendar event: " + e.Message);
}
return newEventId;