static void CancelQueuedBuilds(IBuildServer buildServer) { IQueuedBuildsView queuedBuildsView = buildServer.CreateQueuedBuildsView("Contoso"); queuedBuildsView.StatusFilter = QueueStatus.Queued; queuedBuildsView.QueryOptions = QueryOptions.Definitions | QueryOptions.Controllers; queuedBuildsView.Refresh(false); foreach (IQueuedBuild queuedBuild in queuedBuildsView.QueuedBuilds) { queuedBuild.Cancel(); } }
static void CancelQueuedBuilds(IBuildServer buildServer) { IQueuedBuildsView queuedBuildsView = buildServer.CreateQueuedBuildsView("Contoso"); queuedBuildsView.StatusFilter = QueueStatus.Queued; queuedBuildsView.QueryOptions = QueryOptions.Definitions | QueryOptions.Controllers; queuedBuildsView.Refresh(false); foreach (IQueuedBuild queuedBuild in queuedBuildsView.QueuedBuilds) { queuedBuild.Cancel(); } }