问题
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