尝试创建事件时,出现很多与ErrorIrresolvableConflict响应代码相关的错误
Stack Trace - at Microsoft.OData.ProxyExtensions.DataServiceContextWrapper.<SaveChangesAsync>d__5e.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Office365CalendarProviderBL.<>c__DisplayClass7_0.<<CreateCalendarEvent>b__0>d.MoveNext() - Inner Exception - Microsoft.OData.Client.DataServiceRequestException: An error occurred while processing this request. ---> Microsoft.OData.Client.DataServiceClientException: {"error":{"code":"ErrorIrresolvableConflict","message":"The send or update operation could not be performed because the change key passed in the request does not match the current change key for the item."}}
--- End of inner exception stack trace ---
at Microsoft.OData.Client.SaveResult.HandleResponse()
at Microsoft.OData.Client.BaseSaveResult.EndRequest()
at Microsoft.OData.Client.DataServiceContext.EndSaveChanges(IAsyncResult asyncResult)
at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.OData.ProxyExtensions.DataServiceContextWrapper.<SaveChangesAsync>d__5e.MoveNext()
我收到带有此异常的消息-无法执行发送或更新操作,因为在请求中传递的更改密钥与该项目的当前更改密钥不匹配。
请说明什么是更改密钥以及它如何工作?
我只是从昨天开始获得这些异常,并且没有更改任何代码。我需要在最后更新任何内容还是丢失任何内容?
我正在使用V1 DLL-https://api.office.com/discovery/v1.0/me/
ProxyExtension版本-23
码:-
// In this method, we are populating event properties later used to create event on calendar. Please verify if I am missing any important property here
private Event CreateCalEventObj(CalendarMeetingBL meeting, string location, meetingAdditionalDataBL data)
{
Event calEvent = new Event();
try
{
calEvent.Subject = WEB.HttpUtility.HtmlDecode(meeting.MeetingName);
calEvent.ShowAs = FreeBusyStatus.Busy;
if (meeting.EventAlarmInMinutes == -1)
meeting.EventAlarmInMinutes = null;
calEvent.Reminder = meeting.EventAlarmInMinutes;
calEvent.Start = meeting.StartTime;
calEvent.End = meeting.EndTime;
calEvent.StartTimeZone = meeting.TimeZoneString;
calEvent.EndTimeZone = meeting.TimeZoneString;
if (!string.IsNullOrEmpty(location) && location.Length <= 500)
{
calEvent.Location = new Microsoft.Office365.OutlookServices.Location()
{
DisplayName = CommonBL.FixLineBreakForGooglelocation(WEB.HttpUtility.HtmlDecode(location.Replace("\n", " ")))
};
}
else if (!string.IsNullOrEmpty(data.Phone))
{
calEvent.Location = new Microsoft.Office365.OutlookServices.Location()
{
DisplayName = "Phone: " + CommonBL.FixLineBreakForGooglelocation(WEB.HttpUtility.HtmlDecode(data.Phone))
};
}
else if (!string.IsNullOrEmpty(data.MobileNumber))
{
calEvent.Location = new Microsoft.Office365.OutlookServices.Location()
{
DisplayName = "Mobile: " + CommonBL.FixLineBreakForGooglelocation(WEB.HttpUtility.HtmlDecode(data.MobileNumber))
};
}
calEvent.Body = new ItemBody()
{
Content = CommonBL.RevertLineBreakPlaceHolder((WEB.HttpUtility.HtmlDecode(meeting.MeetingDetails.Replace(@"\\\", "\\"))))
};
}
catch (Exception ex)
{
BLFactory.CurrentInstance.LoggingBLObj.InsertLog("Insert logging here");
calEvent = null;
}
return calEvent;
}
// In this method we are creating event on calendar.
private string CreateCalendarEvent(CalendarMeetingBL meeting, List<ParticipantBL> invitees, string username, string calendarId, OutlookServicesClient service, string location, meetingAdditionalDataBL data, string meetingId = "-1")
{
var taskCreateMeeting = Task<string>.Run(
async () =>
{
Event calEvent = CreateCalEventObj(meeting, location, data);
if (calEvent != null)
{
try
{
//Add invitees to the event
foreach (ParticipantBL inviteeItem in invitees)
{
if (!inviteeItem.IsAdditional)
{
calEvent.Attendees.Add(new Attendee()
{
EmailAddress = new EmailAddress()
{
Address = inviteeItem.Email.Replace("'", "'"),
Name = inviteeItem.Name
},
Type = AttendeeType.Required,
Status = new ResponseStatus()
{
Response = ResponseType.Accepted,
Time = DateTime.Now
}
});
}
}
}
catch (Exception ex)
{
BLFactory.CurrentInstance.LoggingBLObj.InsertLog(meeting.MeetingId, username, "Locally User ID is Meeting id AND email is username - Scheduling Logging Exception 3 - Stack Trace - " + ex.StackTrace + " - Inner Exception - " + ex.InnerException + " - meetingObjValues - " + meetingObjValues + " - meetingAdditionalDataObjValues - " + meetingAdditionalDataObjValues + " - username - " + username + " - calendarId - " + calendarId + " - location - " + location + " - meetingId - " + meetingId, meeting.MeetingId);
return "-1";
}
try
{
var providerDefault = (String.IsNullOrEmpty(calendarId) ? service.Me.Events : service.Me.Calendars[calendarId].Events);
await providerDefault.AddEventAsync(calEvent); // We are getting Exception here but Event is created in calendar
return calEvent.Id; // Event object is not updated after exception
}
catch (Exception ex)
{
BLFactory.CurrentInstance.LoggingBLObj.InsertLog("Insert exception logging here");
return "-1";
}
}
else
return "-1";
}
);
Task.WaitAll(taskCreateMeeting);
string id = taskCreateMeeting.Result;
return id;
}
我们得到的异常类型为Microsoft.OData.Client.DataServiceRequestException,但未在专用catch块下捕获
catch (Microsoft.OData.Client.DataServiceRequestException ex)
{
BLFactory.CurrentInstance.LoggingBLObj.InsertLog("Insert logging here");
return "-1";
}
让我知道是否还有其他要求
提前致谢。
最佳答案
这与OData没有直接关系-我们已经在EWS中看到了同样的事情。我们只是在导致此问题的Exchange代码内部发现了潜在的竞争条件,而我们的一位开发人员刚刚检查了此问题的修复程序。因此,它应该很快开始在生产中推广。
您的代码没有任何错误会导致新项目出现。
关于active-directory - 创建事件时发生ErrorIrresolvableConflict,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/38102586/