2

これは、Outlook の予定表アイテムにアクセスし、件名を変更し、拡張プロパティを追加して、それ自体を更新するためのコードです。しかし、私はエラーが発生しています

少なくとも 1 つの受信者が無効です

アイテムを更新しようとしているとき。アイテムに無効な受信者はいないと思います。このエラーが発生する理由と、これを克服する方法を教えてください。私に助言してください。ありがとうございました。

コードは次のとおりです。

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);
    }
}

助けてくれてありがとう、クシャン・ランディマ。

4

1 に答える 1

3

列挙型のUpdate受け渡しをサポートするのオーバーロード バージョンを使用してみてください。これにより、サーバーが会議の更新を出席者に送信しようとしなくなります。SendInvitationsOrCancellationsModeSendInvitationsOrCancellationsMode.SendToNone

于 2015-05-11T15:03:21.287 に答える