Reputation: 6126
I am trying to create a TFS plugin that binds to the WorkItemChangedEvent and prevents the change based on some rules I will implement later. I have found some example code online and this is what I've got so far, however I would expect this to prevent all changes to work items but it doesn't seem to have any effect. There is no errors in the event viewer for TFS.
public class CwoWorkItemChangedEventHandler : ISubscriber
{
public Type[] SubscribedTypes()
{
return new[] { typeof(WorkItemChangedEvent) };
}
public EventNotificationStatus ProcessEvent(TeamFoundationRequestContext requestContext, NotificationType notificationType,
object notificationEventArgs, out int statusCode, out string statusMessage,
out ExceptionPropertyCollection properties)
{
statusCode = 0;
properties = null;
statusMessage = String.Empty;
return EventNotificationStatus.ActionDenied;
}
public string Name
{
get { return "CwoWorkItemChangedEventHandler"; }
}
public SubscriberPriority Priority
{
get { return SubscriberPriority.High; }
}
}
}
Upvotes: 1
Views: 486
Reputation: 23444
The work item changed event is not a decision out and you can't deny it.
But the time that you have the event it has already happened. Only some events have decision points.
Upvotes: 3