I have the method below that posts a comment to a work-item in Azure DevOps.
How can i @
a user in the comment?
The Two examples below just posts a string that is @firstName lastName
and not tagging the user.
pMessage = "@User you need to take a look at this workitem"
pMessage = "@firstName lastName <mail> you need to take a look at this workitem"
public async Task PingUser(List<int> pId, string pMessage, VssConnection pConnection)
{
WorkItemTrackingHttpClient client = pConnection.GetClient<WorkItemTrackingHttpClient>();
foreach (var id in pId)
{
await client.UpdateWorkItemAsync(
new JsonPatchDocument()
{new JsonPatchOperation(){
Operation = Operation.Add,
Value = pMessage,
Path = "/fields/System.History",
}}, id);
}
}