Retrieving subscriptionid

Aug 13, 2009 at 1:26 PM

Once a listener is started and the subscription is started, lets say via

in your sample code


How do I retrieve the subscriptionid in order to unscubscribe when I have to?

In your sample code you made a perfect sample how to setup and construct the adapter, listener and subscription.

You also assume that when then code is stopped you still want to capture newmail messages on the CAS server and when you start the code you will retrieve them again.

This might not always be the case and causes the well - known 'unable to send...' error on the CAS server because the listener is destroyed, whether have you've saved in a stream capture like you did or did not save it to a file. If you have 200 subscriptions your System Administrator would go crazy with this error. 7 attempts times 200!

Could you give some insight in a good destructor methodology for this?


Thanks in advance.


Best Regards,

Ben Hiep


Aug 13, 2009 at 1:31 PM

you simply remove the subscription object from the collection.

Upon the next notification from Exchange, the subscription will be removed. This is in fact the only way to cancel a subscription, because there is no unsubscribe method for push notifications.