日历项目更新时出现 Exchange 错误:- 至少有一个收件人无效
Exchange Error on Calendar item update :- At least one recipient isn't valid
这是访问我的 outlook 日历项的代码,更改它们的主题,添加一些扩展 属性 并自行更新。但是我收到一个错误
At least one recipient isn't valid
当我尝试更新项目时。我相信该项目中没有任何无效的收件人。为什么我会收到此错误以及如何克服此错误。请给我建议。谢谢。
代码如下:
public void AccessCalendarItems()
{
// Specify a view that returns up to 1000 items.
ItemView view = new ItemView(1000);
// Specify a calendar view for returning instances between matching dates.
DateTime startDate = new DateTime(2015, 5, 1);
DateTime endDate = new DateTime(2015, 9, 1);
CalendarView calView = new CalendarView(startDate, endDate);
//string querystring = "Subject:'Doctor'";
try
{
// Find all the appointments in the calendar based on the dates set in the CalendarView. - Currently Disabled
// Find all the appointments in the calendar based on the sunject content (get first 1000 items)
int i = 123123;
SearchFilter subjectFilter = new SearchFilter.ContainsSubstring(AppointmentSchema.Subject, "Doctor");
FindItemsResults<Item> instanceResults = service.FindItems(WellKnownFolderName.Calendar, subjectFilter, view);
foreach (Item item in instanceResults.Items)
{
Appointment appointment = item as Appointment;
MessageBox.Show(appointment.Subject);
appointment.Subject = appointment.Subject + " - KR";
ExtendedPropertyDefinition extendedPropertyDefinition = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.PublicStrings, "BookingKey", MapiPropertyType.String);
appointment.SetExtendedProperty(extendedPropertyDefinition, i);
appointment.Update(ConflictResolutionMode.AutoResolve);
i++;
}
}
catch (Exception ex)
{
MessageBox.Show("Error: " + ex.Message);
}
}
感谢您的帮助,Kushan Randima。
尝试使用支持传递 SendInvitationsOrCancellationsMode
枚举的 Update
重载版本,然后传递 SendInvitationsOrCancellationsMode.SendToNone
。这将确保服务器不会尝试向与会者发送会议更新。
这是访问我的 outlook 日历项的代码,更改它们的主题,添加一些扩展 属性 并自行更新。但是我收到一个错误
At least one recipient isn't valid
当我尝试更新项目时。我相信该项目中没有任何无效的收件人。为什么我会收到此错误以及如何克服此错误。请给我建议。谢谢。
代码如下:
public void AccessCalendarItems()
{
// Specify a view that returns up to 1000 items.
ItemView view = new ItemView(1000);
// Specify a calendar view for returning instances between matching dates.
DateTime startDate = new DateTime(2015, 5, 1);
DateTime endDate = new DateTime(2015, 9, 1);
CalendarView calView = new CalendarView(startDate, endDate);
//string querystring = "Subject:'Doctor'";
try
{
// Find all the appointments in the calendar based on the dates set in the CalendarView. - Currently Disabled
// Find all the appointments in the calendar based on the sunject content (get first 1000 items)
int i = 123123;
SearchFilter subjectFilter = new SearchFilter.ContainsSubstring(AppointmentSchema.Subject, "Doctor");
FindItemsResults<Item> instanceResults = service.FindItems(WellKnownFolderName.Calendar, subjectFilter, view);
foreach (Item item in instanceResults.Items)
{
Appointment appointment = item as Appointment;
MessageBox.Show(appointment.Subject);
appointment.Subject = appointment.Subject + " - KR";
ExtendedPropertyDefinition extendedPropertyDefinition = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.PublicStrings, "BookingKey", MapiPropertyType.String);
appointment.SetExtendedProperty(extendedPropertyDefinition, i);
appointment.Update(ConflictResolutionMode.AutoResolve);
i++;
}
}
catch (Exception ex)
{
MessageBox.Show("Error: " + ex.Message);
}
}
感谢您的帮助,Kushan Randima。
尝试使用支持传递 SendInvitationsOrCancellationsMode
枚举的 Update
重载版本,然后传递 SendInvitationsOrCancellationsMode.SendToNone
。这将确保服务器不会尝试向与会者发送会议更新。