none
ErrorInvalidRecipients when updating Appointment via Managed API SDK 1.1 RRS feed

  • Question

  • Hi all,

     

    I am using the streamed notifications of the Exchange Web Services Managed API SDK.

    I can successfully load my Appointment when my OnNotificationEvent fires, but when I edit some properties and save the Appointment which had no attendees, I get the exception with the above error code. The appointment is saved successfully.

    Anyone with help?

    Tuesday, January 18, 2011 11:25 AM

All replies

  • There should be no different updating an appointment based on a notification event to what you would do normally what does the code look like your using to do the update ?

    Cheers
    Glen

    Wednesday, January 19, 2011 2:34 AM
  • Hi,
    
    This is my code. It throws an exception with ErrorInvalidRecipients if it doesn't have recipients. The original appointment made in Outlook doesn't have recepients either.
    
    <br/>
    
     static void OnEvent(object sender, NotificationEventArgs args)
        {
          StreamingSubscription subscription = args.Subscription;
    
      
    
    
          // Loop through all item-related events. 
          foreach (NotificationEvent notification in args.Events)
          {
    
          
    
            // Display the notification identifier. 
            if (notification is ItemEvent)
            {
    
              // The NotificationEvent for an e-mail message is an ItemEvent. 
              ItemEvent itemEvent = (ItemEvent)notification;
              
    
    
              GetItemResponse response = service.BindToItems(new List<ItemId> { itemEvent.ItemId }, new PropertySet(BasePropertySet.FirstClassProperties)).Single();
    
    
              Item item = response.Item;
              if (item is Appointment)
              {
    
                Appointment appointment = item as Appointment;
     
                
    
    
                if (notification.EventType == EventType.Created)
                {
    
                  Console.WriteLine("Appointment created: " + appointment.Subject);
    
    
    
    appointment.SetExtendedProperty(GetPropertyDefinition(), DateTime.Now.ToString());
                  appointment.Body = "test body";
                  try
                  {
                    appointment.Update(ConflictResolutionMode.AutoResolve);
                  }
                  catch (ServiceResponseException ex)
                  {
                    // If we update an appointment without recipients, exchange ews will thrown an exception 
                    // with ServiceError.ErrorInvalidRecipients error, but successfully updates the item.
                    if (ex.ErrorCode != ServiceError.ErrorInvalidRecipients)
                    {
                      throw;
                    }
                  }
                 
    
                }
    
              }
    
            }
            
            
          }
        }
    
    Wednesday, January 19, 2011 11:57 AM
  • The one thing i noticed is that you have not used the overload that supports specifying SendInvitationsOrCancellationsMode . Its generally a good idea to use this eg if you don't want updates to be sent to the meeting recipients you should use

    t.Update(ConflictResolutionMode.AlwaysOverwrite, SendInvitationsOrCancellationsMode.SendToNone)
    

    The other thing i would try is viewing the Appointment in Mapi editor like OutlookSpy and have a look at the recipients collection on that appointment to whats actually in there if anything. Does this happen on newly created appointment or just existing appointments ?

    Cheers
    Glen

    Thursday, January 20, 2011 2:45 AM
  •  Had the same problem.

    "SendInvitationsOrCancellationsMode.SendToNone" solved it.

    Thanks :-)

    Tuesday, August 30, 2011 6:57 AM