title: EWS API: How to get pull notifications?
body: <p>I am using the <a href="http://msdn.microsoft.com/en-us/library/exchange/dd633709%28v=exchg.80%29.aspx" rel="nofollow">EWS API</a> to connect and retrieve mail from a exchange 2007 server, which works fine. Now I would like to get pull notifications. I have found a example <a href="http://code.msdn.microsoft.com/Exchange-2013-Set-pull-14c8360b/sourcecode?fileId=59943&amp;pathId=794866531" rel="nofollow">here</a>, which is what I have tried:</p>
  
  <pre><code>public IEnumerable&lt;ItemEvent&gt; GetPullNotifications(FolderId folderId)
  {
      PullSubscription subscription = Service.SubscribeToPullNotifications(new FolderId[] { folderId }, 5, null, EventType.NewMail, EventType.Created, EventType.Deleted);
      return subscription.GetEvents().ItemEvents;
  }
  
  public void CheckPullNotifications(object source, ElapsedEventArgs e)
  {
      Console.WriteLine("Check...");
      IEnumerable&lt;ItemEvent&gt; itemEvents = ewsClient.GetPullNotifications(WellKnownFolderName.Inbox);
      foreach (ItemEvent itemEvent in itemEvents)
      {
          switch (itemEvent.EventType)
          {
              case EventType.NewMail:
                  MessageBox.Show("New mail: " + itemEvent.ItemId.UniqueId);
                  break;
              case EventType.Deleted:
                  MessageBox.Show("Mail deleted: " + itemEvent.ItemId.UniqueId);
                  break;
          }
      }
  
      return;
  }
  
  //...
  Timer myTimer = new Timer();
  myTimer.Elapsed += new ElapsedEventHandler(CheckPullNotifications);
  myTimer.Interval = 1000;
  myTimer.Start();
  </code></pre>
  
  <p>However, I never get to the above switch when I put a breakpoint there. I've send a few mails and deleted some, nothing happens.</p>
  
  <p>Any ideas why this does not work? Or are there any other ways to get pull notifications?</p>