在System.History中提及用户 [英] Mentioning a user in the System.History

查看:82
本文介绍了在System.History中提及用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试向提及用户的工作项添加新注释,但是像在网站上那样使用传统的"@adamh"似乎无法通过API起作用.

I'm trying to add a new comment to a work item which mentions a user, but using the traditional "@adamh" as you would do on the website does not seem to work via the API.

数据更新正常,但是"@adamh"只是纯文本,我需要能够以某种方式将一个标识插入此处.谁能指出我正确的方向?

The data updates fine, however the "@adamh" is just plain text, I need to be able to somehow chuck an identity into here. Can anyone point me in the right direction?

谢谢!

代码段在这里

const vsts = require('vso-node-api');
const item = require('vso-node-api/WorkItemTrackingApi')
const ti = require('vso-node-api/interfaces/WorkItemTrackingInterfaces');
// your collection url
const collectionUrl = "https://myArea.visualstudio.com/defaultcollection";
// ideally from config
const token = "helloWorld";


async function run() {
    let authHandler = vsts.getPersonalAccessTokenHandler(token);
    let connection = new vsts.WebApi(collectionUrl, authHandler);
    let itemTracking = await connection.getWorkItemTrackingApi();
    //Add all task data to new array
    let taskData = await itemTracking.getWorkItems([15795,15796])

    let newData = taskData[0]

    let wijson = [
        {
            "op": "add",
            "path": "/fields/System.History",
            "value": "@adamh"
        }
    ];

    const updateItem = itemTracking.updateWorkItem(null, wijson, 15795).catch(err => {
        console.log(err)
    }).then(() => console.log("updated"))

    return newData
}

const express = require('express')
const app = express()

app.get('/', async (req, res) => {
    let data = await run()
    res.send(data)
})

app.listen(3000, () => console.log('Example app listening on port 3000!'))

推荐答案

您可以使用 @ 通知其他团队成员有关讨论的信息.只需输入@及其名称即可.

You can use the @ to notify another team member about the discussion. Simply type @ and their name.

它使用 @mention控件,您@mention的人将收到一封电子邮件提醒,其中包含您的评论以及指向工作项,提交,变更集或架子集的链接.

It's using the @mention control , the person you @mention will receive an email alert with your comment and a link to the work item, commit, changeset, or shelveset.

没有任何公开的API显示VSTS中的工作原理,您可以尝试在Google浏览器中使用F12来跟踪该过程.另一个解决方法是直接使用API​​向要提及的用户发送通知.

There is not any public API shows how this work in VSTS, you could try to use F12 in google browser to track the process. Another workaround is directly using API to send a notification to the user you want to mention at.

这篇关于在System.History中提及用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆