Sergiy Bondar
Sergiy Bondar

Reputation: 11

EWS OnSubscriptionError return error - Subscription is invalid

I am using Streaming notification for event types - EventType.Created, EventType.Modified, EventType.Deleted and EventType.Moved.
I run my application and notification subscription works fine in general.
But sometimes and randomly got next error:

Subscription is invalid., This message indicates no more events will occur for this EventSink. Event = Event. TimeStamp = 11/4/2020 1:56:02 PM. Event type = MailboxMoveStarted, Object Type = None, .ObjectId = ..

The error description contains - Event type = MailboxMoveStarted, but EventType enum does not contain this item

It happened on event OnSubscriptionError and then connection closed. Problem was for O365 mailbox.

Upvotes: 1

Views: 608

Answers (1)

pjneary
pjneary

Reputation: 1246

So in my experience, when you are using streaming notifications, your code has to be prepared for all kinds of exceptions, particularly when going against O365. The cloud infrastructure behind EWS is kind of fluid, so subscriptions will tend to die out on you over the course of a day or two, or even a few hours. The event you are seeing may be a new notification type, and moving MBs around is a common thing for O365. Best to just toss the subscription and resubscribe ASAP.

Upvotes: 1

Related Questions