How to update TFS work item in native plugin while ISubscriber.ProcessEvent?
I wrote a TFS 2013 plugin via an interface implementation Microsoft.TeamFoundation.Framework.Server.ISubscriber
. In the method, ProcessEvent
I check if the work item was changed with
if (notificationType == NotificationType.Notification &&
notificationEventArgs is WorkItemChangedEvent)
and if true i want to update this work item. What is the best way to achieve this?
My current solution is to open a client TFS connection using a library Microsoft.TeamFoundation.Client
, find the work item, and update it. The problem here is that this is the second change since the event was originally fired. Can I hook up to an update event and change a work item in the same workflow?
source to share
No, you need to go down to the Client creation root and download the work item. However, you can put the bypass text in the edit username. The ui will display the "edited AwesomePlugin4 from TfsService.
So if the editing was done by your plugin, you can skip.
In addition, you may have a performance degradation as you can pause processing. A better model would be to put your update logic in a TfsJob and fire the job on an event on change. Then your work can get done and make any changes or workarounds as needed. It is much more reliable.
http://exsertus.wordpress.com/2013/10/10/custom-tfs-jobs-and-job-monitoring/
source to share