Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/323.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# SharePoint全天事件不一致_C#_Sharepoint_Event Handling_Executequery - Fatal编程技术网

C# SharePoint全天事件不一致

C# SharePoint全天事件不一致,c#,sharepoint,event-handling,executequery,C#,Sharepoint,Event Handling,Executequery,我正在使用一个事件接收器来更新两个日历,以保持两个日历的同步。我的代码很好,但我注意到,当导出“全天事件”时,它会给新列表一个不同的结束日期 例: 原始列表 标题:Test1 结束日期:2016年1月28日11:59下午 全天活动:是 新名单 标题:Test1 截止日期:2016年1月29日11:59 全天活动:是 如何阻止将EndDate更新到第二天 UpdateItem[“Title”]=properties.ListItem[“Title”]; UpdateItem[“EventDate

我正在使用一个事件接收器来更新两个日历,以保持两个日历的同步。我的代码很好,但我注意到,当导出“全天事件”时,它会给新列表一个不同的结束日期

例:

原始列表 标题:Test1
结束日期:2016年1月28日11:59下午
全天活动:是

新名单 标题:Test1
截止日期:2016年1月29日11:59 全天活动:是

如何阻止将EndDate更新到第二天

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()找到了答案。希望这对其他人有帮助

UpdateItem[“EndDate”]=DateTime.Parse(properties.AfterProperties[“EventDate”].ToString(),null,DateTimeStyles.AdjustToUniversal)