Subscribing to TFS Events

You can subscribe to events by selecting the filters and the delivery preferences you want applied to the events. You can choose to receive events immediately when they occur.

Subscription API

A subscription is defined by a subscriber, an event, and a delivery mechanism such as e-mail. A subscription can have one filter, but it may be composed of sub-expressions joined with or or and.

Subscription

The SubscribeEvent method adds a subscription to the Eventing Service. You can have multiple subscriptions to the same event type. However, you will receive only one notification, regardless of the number of matching subscriptions.

The SubscribeEvent method returns the unique subscriptionId for the subscription. You can use the subscriptionId to unsubscribe to the event later.

There are five parameters used with the SubscribeEvent method.

  • userId can be specified, but it is ignored in this version.

  • eventType is required, and represents the fully-qualified name of the event type to which you are subscribing.

  • filterExpression is required, and is a string that describes how to filter through many instances of this event type. Only events that match the filter are delivered.

  • DeliveryPreference is a required parameter, but it is ignored in this version, and is reserved for future use.

  • tag is an optional parameter that can be used to specify groups of subscriptions.

Unsubscription

Use the UnsubscribeEvent to remove a subscription with the specified subscriptionId.

EventSubscriptions

The EventSubscriptions method returns an array of the subscriptions associated with the userID.

The optional tag limits the returned set of subscriptions to those that have been subscribed in association with the string tag.

See Also

Concepts

Eventing Service

Eventing Service Architecture

Defining TFS Events

Filtering Team Foundation Server Events

Formatting Team Foundation Server Notifications

Integrating a Web Service Notification Customer

Integrating with Team Foundation Server Security

Reference

IEventService