c# - 日历项目更新时发生 Exchange 错误 :- At least one recipient isn't valid

标签 c# outlook exchangewebservices extended-properties

这是用于访问我的 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。这将确保服务器不会尝试向与会者发送 session 更新。

关于c# - 日历项目更新时发生 Exchange 错误 :- At least one recipient isn't valid,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30162357/

相关文章:

c# - 如何从 .mov 视频文件头(QuickTime 文件格式)中读取比特率信息?

c# - 验证证书 TLS/SSL 服务器

asp.net - 如何使用 ASP.NET VB 以编程方式取消 Outlook session ?

oauth-2.0 - 错误 : ExchangeImpersonation SOAP header must be present for this type of oauth token

c# - Sharepoint 2013 EWS 收件箱 webpart 错误 401 未经授权

c# - 如何为类的继承者专门化参数类型?

c# - 如何获取窗口下内容的快照图像?

在 Mac 上的 Outlook 中损坏的 HTML 电子邮件签名 - 在 Windows 上工作正常吗?

vba - 在 Outlook 中收到新邮件后,如何传递第二个变量以运行?

Silverlight 3 - 交换网络服务