none
How I Can Add Subscriptions to an open EWS connection. RRS feed

  • Question

  • Hi,

    I add Subscription in my EWS Connexion.

    When, in my inbox, I add new folder, I would like it is considered (and its contents)in Streaming Notifications.

    I tested thiscode, but it does not work.

     public bool SetStreamingNotifications(ExchangeService service)       

    {           

    try            {                        StreamingSubscription streamingsubscription = service.SubscribeToStreamingNotifications(                    listFolders.ToArray(),                    EventType.NewMail,                    EventType.Created,                    EventType.Deleted,                    EventType.Moved,                    EventType.Modified);                               if (_connection == null)                {                    _connection = new StreamingSubscriptionConnection(service, 30);                  }                               _connection.AddSubscription(streamingsubscription);                _connection.OnNotificationEvent +=                    new StreamingSubscriptionConnection.NotificationEventDelegate(OnEvent);                _connection.OnSubscriptionError +=                    new StreamingSubscriptionConnection.SubscriptionErrorDelegate(OnError);                _connection.OnDisconnect +=                    new StreamingSubscriptionConnection.SubscriptionErrorDelegate(OnDisconnect);                if (_connection.IsOpen == false)                {                    _connection.Open();                }                               LogClient.Log.Info("Paramètrage du streaming.");                return true;            }            catch (Exception e)            {                LogClient.Log.Error("Erreur de paramètrage du streaming : ", e);                return false;            }        }



    Tuesday, September 17, 2013 8:10 AM

All replies

  • Hi,

    I add Subscription in my EWS Connexion.

    When, in my inbox, I add new folder, I would like it is considered (and its contents)in Streaming Notifications.

    I tested thiscode, but it does not work.

     public bool SetStreamingNotifications(ExchangeService service)       

    {           

    try            {                       

    StreamingSubscription streamingsubscription = service.SubscribeToStreamingNotifications(                   

    listFolders.ToArray(),                   

    EventType.NewMail,                   

    EventType.Created,                   

    EventType.Deleted,                   

    EventType.Moved,                   

    EventType.Modified);                              

    if (_connection == null)               

    {                   

    _connection = new StreamingSubscriptionConnection(service, 30);                 

    }                              

    _connection.AddSubscription(streamingsubscription);               

    _connection.OnNotificationEvent +=                    new StreamingSubscriptionConnection.NotificationEventDelegate(OnEvent);               

    _connection.OnSubscriptionError +=                    new StreamingSubscriptionConnection.SubscriptionErrorDelegate(OnError);               

    _connection.OnDisconnect +=                    new StreamingSubscriptionConnection.SubscriptionErrorDelegate(OnDisconnect);               

    if (_connection.IsOpen == false)               

    {                   

    _connection.Open();               

    }                              

    LogClient.Log.Info("Paramètrage du streaming.");               

    return true;           

    }           

    catch (Exception e)           

    {               

    LogClient.Log.Error("Erreur de paramètrage du streaming : ", e);               

    return false;           

    }       

    }




    Tuesday, September 17, 2013 8:11 AM
  • Thank for your help.
    Tuesday, September 17, 2013 8:12 AM
  • Wednesday, September 18, 2013 5:29 AM