Search code examples
c#tfsworkitem

How to subcribe on WorkItem state changes on TFS?


Good day!

I want to know, how to subcribe on WorkItem state changes on TFS 2010\2013?

Should i use WCF?

Please tell we the way.

Thank you.

P.S. i need to get access to tfs workitem changes via c# : when workitem changed- i want to get some notification and do some operations via c#

For example: i have console program,wich get all workitems. But it get by run sheduler. I want to subscribe my program on some event like onWorkItemChanged: when some user change task- program get this changed and do some work.


Solution

  • There are different ways to achive this. You can do it directly within the process of tfs by implementing an ISubscriber and listening to the WorkitemChangedEvent:

    http://www.almguide.com/2011/12/tfs-server-side-event-handlers/

    Or using the client API you can register a wcf service to get notified for workitem changes. So you can implement the logic on a different tier.

    You can find both implementations here:

    http://tfswiwatcher.codeplex.com

    The 2010 Version uses the client side way and the 2012 and 2013 versions are using the server side way.