How to create a TFS alert for changes to the items' Stack Rank field

喜欢而已 提交于 2020-02-04 01:17:11

问题


How can I create an alert when any team member makes changes to the Stack Rank field (only) of any work item in TFS?


回答1:


You can add a alter filter in a work item team alter just including Stack Rank changes

Sample:


Update

You can also try to use TFS API to achieve this. Below code shows how to query workitems whether a field (ex. System.AssignedTo field) is changed on a given day. For stank rank, FieldName="Microsoft.VSTS.Common.StackRank"

void Main()
{
    const String CollectionAddress = "http://mytfsserver/tfs/MyCollection";

    using (var tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(CollectionAddress)))
    {
        var server = tfs.GetService<WorkItemStore>();
        var changes =
            server.Query("select * from WorkItems where [System.ChangedDate] = @Today")
            .Cast<WorkItem>()
            .SelectMany(wi =>
                wi.Revisions
                .Cast<Revision>()
                .SelectMany(r =>
                    r.Fields
                    .Cast<Field>()
                    .Where(f => !String.IsNullOrEmpty(f.OriginalValue as String) && f.Value != f.OriginalValue && f.ReferenceName == "System.AssignedTo")
                    .Select(f => new { wi.Id, f.OriginalValue, f.Value, f.ReferenceName, })))
            .Dump();
    }
}

More detials about how to programilly query work items, please refer the link from MSDN:Query for Bugs, Tasks, and Other Work Items



来源:https://stackoverflow.com/questions/39530090/how-to-create-a-tfs-alert-for-changes-to-the-items-stack-rank-field

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!