0

I am using an event receiver to ItemUpdated function to keep two calendars in sync. My code words fine but I notice that when "All Day Event" is exported it gives the new list a different end date.

EX:

Original List

Title: Test1
End Date: 1/28/2016 11:59pm
All Day Event: Yes

New List

Title: Test1
End Date: 1/29/2016 11:59pm
All Day Event: Yes

How can I stop this from updating the EndDate to the next day?

UpdateItem["Title"] = properties.ListItem["Title"];
UpdateItem["EventDate"] = properties.ListItem["EventDate"];
UpdateItem["EndDate"] = properties.ListItem["EndDate"];
UpdateItem["fAllDayEvent"] = properties.ListItem["fAllDayEvent"];
properties.ListItem.Update();
UpdateItem.Update();
context.ExecuteQuery();
Shark Tank
  • 25
  • 5

1 Answers1

0

Found the answer. Hope this helps someone else

UpdateItem["EndDate"] = DateTime.Parse(properties.AfterProperties["EventDate"].ToString(), null, DateTimeStyles.AdjustToUniversal);
Shark Tank
  • 25
  • 5