Quantcast
Channel: Exchange Server Development forum
Viewing all articles
Browse latest Browse all 7132

How I Can Add Subscriptions to an open EWS connection.

$
0
0

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)inStreaming Notifications.

I tested thiscode, butit 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;            }        }




Viewing all articles
Browse latest Browse all 7132

Trending Articles