我正在尝试以编程方式添加在工作项的讨论区域中提及TFS中组成员的用户。我们使用1.0版本与TFS 2017更新2成功:
<a href=\"{id.UniqueName}\" data-vss-mention=\"version:1.0\">@{id.DisplayName}</a>
但是,升级到TFS 2017更新3无法发送有关通知的电子邮件。我们还尝试了在TeamFoundationIdentitiy对象上找到的所有“用户ID”,以找到这里找到的解决方案:VSTS - uploading via an excel macro and getting @mentions to work
那么我们怎样才能让@mentions的电子邮件再次在TFS 2017.3中运行?
更新:9/11/2018
已验证的服务帐户无法发送电子邮件,而我的帐户运行相同的代码将发送电子邮件提及:
using (var connection = new VssConnection(collectionUri, cred))
using (var client = connection.GetClient<WorkItemTrackingHttpClient>())
{
var wi = new JsonPatchDocument
{
new JsonPatchOperation()
{
Operation = Operation.Add,
Path = "/fields/System.History",
Value = $"<a href=\"mailto:{id.Descriptor.Identifier}\" data-vss-mention=\"version:1.0\">@{id.DisplayName}</a> <br/>"
}
};
using (var response = client.UpdateWorkItemAsync(wi, workItemId, suppressNotifications: false))
{
response.Wait();
}
}
我们通过删除WorkItemHttpClient的使用并返回加载SOAP WorkItemStore作为提交更改而不是服务帐户的用户来解决问题。如果我们可以使用TFS的WebApi模拟用户,那就太好了