【发布时间】:2021-08-20 17:28:21
【问题描述】:
我们在 tfs 中有一个插件。此插件会在任何工作项更改时通知我们。我们可以获得工作项详细信息,例如 id、变更集列表,如下所示。但是我们还需要工作项相关的分支名称。
您能帮帮我吗,当工作项在下面的代码中更改时,有什么方法可以获取相关的分支名称。
谢谢
public EventNotificationStatus ProcessEvent(
IVssRequestContext requestContext,
NotificationType notificationType,
object notificationEventArgs,
out int statusCode,
out string statusMessage,
out ExceptionPropertyCollection properties)
{
statusCode = 0;
properties = null;
statusMessage = String.Empty;
try
{
if (notificationType == NotificationType.Notification && notificationEventArgs is WorkItemChangedEvent)
{
WorkItemChangedEvent ev = notificationEventArgs as WorkItemChangedEvent;
int workItemId = Convert.ToInt32(ev.CoreFields.IntegerFields[0].NewValue);
WriteLog("1WorkItemChangedEventHandler WorkItem " + ev.WorkItemTitle + " - Id " + workItemId.ToString() + " was modified");
}
}
catch (Exception)
{
}
return EventNotificationStatus.ActionPermitted;
}
【问题讨论】:
标签: tfs azure-devops branch tfs-workitem