Search code examples
azure-devops-extensions

Is there an interface for VSTS with similar functionality to WorkItemChangedEventHandler


I have created an extension for on-prem TFS that I am trying to port to work with VSTS Online, and eventually publish to the Marketplace.

In my TFS version I used the Microsoft.TeamFoundation.Framework.Server.ISubscriber interface to hook into the WorkItemChangedEvent event to run my code whenever a work item is created or saved.

I'm having trouble locating an analogous VSTS extension point that I can use to execute my code when work items are modified/created, or a sample project that would be instructive to building this kind of extension.

I'd appreciate a point in the right direction. Is this even possible with a VSTS extension?


Solution

  • Not really. Extensions are great for adding new UI-driven functionality or packaging up build/release tasks, but they're not designed to be background services.

    The way this is commonly handled is via a service hook. You write your own REST endpoint and deploy it to Azure/AWS, then set up a service hook to call it when work items are created or updated, and have it call back into VSTS via a PAT/OAuth token.

    You can see how this is implemented in the open-source TFS Aggregator project.