does not exist 对于 W-6ren">
gpt4 book ai didi

TFS IEventService "Event type CheckinEvent does not exist"

转载 作者:行者123 更新时间:2023-12-02 22:11:53 24 4
gpt4 key购买 nike

我正在尝试使用 TFS IEventService 在 TFS 2010 中订阅 CheckinEvent。出于某种原因,我不断得到:

Event type <<event type>> does not exist

对于 WorkItemChangedEventCheckinEvent。我做错了什么?

var serverUri = new Uri("http://TFS_SERVICE:8080/tfs");
var server = TfsConfigurationServerFactory.GetConfigurationServer(serverUri);

var eventService = server.GetService<IEventService>();
var preference = new DeliveryPreference
{
Schedule = DeliverySchedule.Immediate,
Type = DeliveryType.Soap,
Address = "http://localhost:61773/NotifyService.asmx"
};

int eventId = eventService.SubscribeEvent("CheckinEvent", null, preference);

最佳答案

您正在配置服务器级别查询事件服务。这些事件类型只存在于团队项目集合级别,我假设这是您真正想要创建事件订阅的地方。您需要将代码更改为如下所示:

var serverUri = new Uri("http://TFS_SERVICE:8080/tfs/collection");

TfsTeamProjectCollection collection = new TfsTeamProjectCollection(serverUri);
var eventService = collection.GetService<IEventService>();

var preference = new DeliveryPreference
{
Schedule = DeliverySchedule.Immediate,
Type = DeliveryType.Soap,
Address = "http://localhost:61773/NotifyService.asmx"
};

int eventId = eventService.SubscribeEvent("CheckinEvent", null, preference);

请注意,URI 需要包含您的集合名称。

关于TFS IEventService "Event type CheckinEvent does not exist",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15160875/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com