none
EWS Managed API: Updated an recurring appointment, the update succeeds but throws an exception RRS feed

  • Question

  • EWS Managed API: Updated an recurring appointment, the update succeeds but still throws an exception: "One or more recipients are invalid.". If the appointment is not recurring it works perfect. Here is the code:
     

    using Microsoft.Exchange.WebServices.Data;

    try
    {
       ItemId iid = new ItemId(uid);
       Item selectedItem = Item.Bind(service, iid);
       if (selectedItem != null)
       {
          selectedItem.Subject = "TEST: " + selectedItem.Subject;
          selectedItem.Update(ConflictResolutionMode.AlwaysOverwrite); // This line throws an exception
       }
    }
    catch (Exception ex)
    {
       EventLog.WriteEntry(sSource, "Ex = " + ex.Message, EventLogEntryType.Information);            
    }

    Can somebody help me?


    Stig Wulff
    Friday, March 11, 2011 9:44 PM

All replies

  • I noticed that in case of appointments you have to use override Update method from Appointment class which has additional argument SendInvitationsOrCancellationMode enum. I had the same exception in one of my methods where I treated every item as an Item and I had to add condition to act differently if I was dealing with appointment (recurring or not).

    Try something like this

     

    if (item is Appointment)
    {
      var app = item as Appointment;
      app.Update(ConflictResolutionMode.AlwaysOverwrite, SendInvitationsOrCancellationsMode.SendToNone);
    }
    else
      item.Update(ConflictResolutionMode.AlwaysOverwrite);
    

     

    Wednesday, August 24, 2011 1:17 PM