title: EWS Managed API with pull subscriptions
body: <p>I am writing a bridge to synchronise our client application with EWS via the managed API.</p>
  
  <p>I'm running into a lot of problems caused by the fact that  I don't know who has last updated the appointment I'm working with(Outlook client/owa/My bridge).</p>
  
  <p>There are certain appointments (tagged with a category[0] = 'Booking') that I don't want the user to modify, but I cant tell whether it was updated by the user or my bridge.</p>
  
  <p>is there a way I can create the appointment as Read-only, or get the old info for the appointment and revert it back ?</p>
  
  <p>I've tried to kind of show what I mean below :</p>
  
  <pre><code>public void TimerCallback(object source, ElapsedEventArgs e)
      {
          FPollTimer.Enabled = false;
          try
          {
              GetEventsResults notificationEvents = FCalendarSubscription.GetEvents();
              EWSMethods.monitorFRM.log("Notification count  = " + FEWSUser + ":" + notificationEvents.AllEvents.Count.ToString()); 
  
              if (notificationEvents.AllEvents.Count &gt; 0)
              {
                  foreach (ItemEvent itemEvent in notificationEvents.ItemEvents)
                  {
                      // -- check to see if this is a valid appointment  -- //
                      // -- Echange creates two appts and deletes one of -- //
                      // -- them for any appointment creation            -- //
  
                      try
                      {
                          //Folder tempFolder = Folder.Bind(FEWSService, itemEvent.ParentFolderId.ToString());
                          EWSMethods.monitorFRM.log("Notification-" + FEWSUser + " : " + itemEvent.EventType.ToString());
                          // -- Is this item in the stack? -- //
                          if (NeedPingPongcheck(itemEvent))
                          {
                              CheckPingPong(itemEvent);
                          }
                          else
                          {
                              Appointment o_appointment = Appointment.Bind(FEWSService, itemEvent.ItemId.ToString());
                              if (o_appointment != null) WriteEventToDB(itemEvent);
                          }
                      }
                      catch (Exception exc2)
                      {
                          EWSMethods.monitorFRM.log("TimerCallBack inner " + exc2.Message);
                      }
                  }
              }
          }
          catch (Exception exc)
          {
              EWSMethods.monitorFRM.log("timercallback outer " + exc.Message);
              //MessageBox.Show(e.Message);
          }
          FPollTimer.Enabled = true;
      }
  
  
  
  
  public void WriteEventToDB(ItemEvent item)
      {
          try
          {
  
              EWSMethods.monitorFRM.log("Attempting write to DB ");
              string s_allday;
              string s_appointmentid;
              //MessageBox.Show(item.ItemId.ToString());
  
              // -- use the old item id for deleted (moved) appointments -- //
              if (item.EventType == EventType.Moved)
              {
                  s_appointmentid = item.OldItemId.ToString();
              }
              else
              {
                  s_appointmentid = item.ItemId.ToString();
              }
  
              // Get all properties of email message
              PropertySet pset = new PropertySet(BasePropertySet.FirstClassProperties);
  
              // Get the body in text
              pset.RequestedBodyType = Microsoft.Exchange.WebServices.Data.BodyType.Text;
  
              // -- set up allDay flag -- //
              Appointment o_appointment = Appointment.Bind(FEWSService, item.ItemId.ToString(),pset);
  
              if ((o_appointment.IsAllDayEvent) &amp; (o_appointment != null))
              {
                  s_allday = "Y";
              }
              else
              {
                  s_allday = "N";
              }
  
              // -- 
              if (o_appointment.Categories[0] != "Booking")
              {
                  AddInterimEntry(o_appointment,
                                  item,
                                  s_allday,
                                  s_appointmentid,
                                  item.EventType.ToString());
  
              }
              else
              {
  
                  if ((item.EventType == EventType.Modified) || (item.EventType == EventType.Moved)) {
                      EWSMethods.monitorFRM.log("Booking item skipped." + item.OldItemId.ToString());
  
                  }
              }
          }
          catch (Exception e)
          {
              EWSMethods.monitorFRM.log(e.Message);
          }
  
      }
  </code></pre>
  
  <p>Thanks in advance.</p>