简体   繁体   中英

Team Foundation Server plugin WorkItemChangedEvent

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; }
    }
  }
}

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM