title: Outlook ItemAdd event fires twice for new Calendar items
body: <p>I'm working on an Outlook add-in that will monitor the current user's calendar and send that user an email when a specific type of appointment or meeting is received. We have a third party app/service that is sending new meeting requests to user in Outlook, but no notification is given to the user logged into Outlook. My add-in is a workaround until we replace the third party app, so users can be alerted when this meeting request is sent.</p>
  
  <p>I'm using the ItemAdd event to monitor when an appointment/meeting is added (i.e. sent from the third party app). What I'm seeing is that the event fires twice (even though I declared the handler only once): <strong>once</strong> when the appointment is received from a different user, and <strong>once</strong> when the appointment is accepted or tentatively accepted by the current user.</p>
  
  <p>I need it to fire only when the appointment is at first received, not when it is accepted. I could monitor the user's inbox to see if they already received the notification, but I don't think this would work well if they haven't actually received the email before they click Accept (server latency?)</p>
  
  <p>Here is my code. Any ideas would be greatly appreciated.</p>
  
  <pre><code>public partial class ThisAddIn
  {
      Outlook.Items _Appointments = null;
      Outlook.Folder _MyAppointmentsFolder = null;
  
      private void ThisAddIn_Startup(object sender, System.EventArgs e)
      {
          // Initialization.
          _MyAppointmentsFolder = (Outlook.Folder)this.Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar);
          _Appointments = _MyAppointmentsFolder.Items;
          _Appointments.ItemAdd += new Outlook.ItemsEvents_ItemAddEventHandler(appointments_Add);
      }
  
      private void appointments_Add(object item)
      {
          // An appointment has been added. Read the title and send an email based on a condition.
          Outlook.AppointmentItem meetingItem = item as Outlook.AppointmentItem;
          if (meetingItem.Subject.Contains("Service Call"))
          {
              // Let's send ourselves an email.
              string emailTo = string.Format("{0}@concurrency.com", Environment.UserName);
              string subject = meetingItem.Subject;
              string body = meetingItem.Body;
              string startDate = meetingItem.Start.ToString();
              string endDate = meetingItem.End.ToString();
  
              SendEmailAlert(emailTo, subject, body, startDate, endDate);
          }
  
      }
      ....
  </code></pre>