如何使用 Azure Devops 的 .net API 创建具有多行描述文本的 Azure 看板工作项?
How to create a Azure boards work item with multi-line description text using .net API of Azure Devops?
全部
下面是创建工作项的代码。
字符串描述中的“\r\n”无法识别,所以新建项目的描述文字在一行。
如何用代码创建多行描述的工作项,谢谢。
public static WorkItem CreateWorkItem(VssConnection connection, string title, string type, string description, string tags)
{
string project = "xxx";
// Construct the object containing field values required for the new work item
JsonPatchDocument patchDocument = new JsonPatchDocument();
patchDocument.Add(
new JsonPatchOperation()
{
Operation = Operation.Add,
Path = "/fields/System.Title",
Value = title
}
);
patchDocument.Add(
new JsonPatchOperation()
{
Operation = Operation.Add,
Path = "/fields/System.Description",
Value = description
}
);
// Get a client
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
// Create the new work item
WorkItem newWorkItem = workItemTrackingClient.CreateWorkItemAsync(patchDocument, project, type).Result;
Console.WriteLine("Created work item ID {0} {1}", newWorkItem.Id, newWorkItem.Fields["System.Title"]);
return newWorkItem;
}
使用 <br>
而不是 \r\n
。 Powershell 示例:
$pat = '<pat>'
$url = 'https://dev.azure.com/<org>/<project>/_apis/wit/workitems/$Task?api-version=6.1-preview.3'
$body = '[{"op":"add","path":"/fields/System.Title","from":null,"value":"Sample task"}, {"op":"add","path":"/fields/System.Description","from":null,"value":"my line1<br>my line2<br>my line3"}]'
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f "",$pat)))
Invoke-RestMethod -Uri $url -Method Post -ContentType "application/json-patch+json" -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -Body $body
结果:
另外,能否在描述中正确显示Wiki格式?
wiki 格式示例:
h1。 USN-4883-1:Linux 内核漏洞
2021 年 3 月 20 日
Linux 内核中修复了几个安全问题。
h2。发布
- [Ubuntu 18.04 LTS|https://ubuntu.com/security/notices?release=bionic]
- [Ubuntu 16.04 LTS|https://ubuntu.com/security/notices?release=xenial]
- [Ubuntu 14.04 ESM|https://ubuntu.com/security/notices?release=trusty]
h2。包裹
- [linux|/security/cve?package=linux]
-
- Linux内核
- [linux-aws|/security/cve?package=linux-aws]
-
- Linux Amazon Web Services (AWS) 系统内核
- [linux-aws-hwe|/security/cve?package=linux-aws-hwe]
-
- Linux Amazon Web Services (AWS-HWE) 系统内核
- [linux-azure|/security/cve?package=linux-azure]
-
- Linux Microsoft Azure 云系统内核
- [linux-azure-4.15|/security/cve?package=linux-azure-4.15]
-
- Linux Microsoft Azure 云系统内核
- [linux-gcp|/security/cve?package=linux-gcp]
-
- Linux Google 云平台 (GCP) 系统的内核
- [linux-gcp-4.15|/security/cve?package=linux-gcp-4.15]
-
- Linux Google 云平台 (GCP) 系统的内核
- [linux-hwe|/security/cve?package=linux-hwe]
-
- Linux 硬件支持 (HWE) 内核
- [linux-kvm|/security/cve?package=linux-kvm]
-
- Linux 云环境内核
h2。详情
Adam Nichols 发现 iSCSI 子系统中存在堆溢出
在 Linux 内核中。本地攻击者可以使用它来拒绝
服务(系统崩溃)或可能执行任意代码。 (
[CVE-2021-27365|/security/CVE-2021-27365]
Adam Nichols 发现 Linux 内核中的 iSCSI 子系统
没有正确限制对 iSCSI 传输句柄的访问。本地攻击者
可以利用此问题导致拒绝服务或暴露敏感信息
(内核指针地址)。 (
[CVE-2021-27363|/security/CVE-2021-27363]
Adam Nichols 发现 iSCSI 中存在越界读取
Linux 内核中的子系统。本地攻击者可以利用它造成
拒绝服务(系统崩溃)或暴露敏感信息(内核
内存)。 (
[CVE-2021-27364|/security/CVE-2021-27364]
h2。更新说明
可以通过将您的系统更新到以下软件包版本来解决该问题:
h5。 Ubuntu18.04
- [linux-image-4.15.0-1081-raspi2|https://launchpad.net/ubuntu/+source/linux-raspi2]
- [4.15.0-1081.86|https://launchpad.net/ubuntu/+source/linux-raspi2/4.15.0-1081.86]
- linux-image-powerpc-e500mc-4.15.0.139.126
- [linux-image-4.15.0-1096-aws|https://launchpad.net/ubuntu/+source/linux-aws]
- [4.15.0-1096.103|https://launchpad.net/ubuntu/+source/linux-aws/4.15.0-1096.103]
- [linux-image-4.15.0-139-lowlatency|https://launchpad.net/ubuntu/+source/linux]
- [4.15.0-139.143|https://launchpad.net/ubuntu/+source/linux/4.15.0-139.143]
- linux-image-gcp-lts-18.04-4.15.0.1095.113
- [linux-image-4.15.0-1087-kvm|https://launchpad.net/ubuntu/+source/linux-kvm]
- [4.15.0-1087.89|https://launchpad.net/ubuntu/+source/linux-kvm/4.15.0-1087.89]
- linux-image-oracle-lts-18.04-4.15.0.1067.77
- [linux-image-4.15.0-1095-gcp|https://launchpad.net/ubuntu/+source/linux-gcp-4.15]
- [4.15.0-1095.108|https://launchpad.net/ubuntu/+source/linux-gcp-4.15/4.15.0-1095.108]
- linux-image-virtual-4.15.0.139.126
- [linux-image-4.15.0-139-generic-lpae|https://launchpad.net/ubuntu/+source/linux]
- [4.15.0-139.143|https://launchpad.net/ubuntu/+source/linux/4.15.0-139.143]
- linux-image-金鱼草-4.15.0.1098.101
- linux-image-powerpc64-emb-4.15.0.139.126
- [linux-image-4.15.0-1067-oracle|https://launchpad.net/ubuntu/+source/linux-oracle]
- [4.15.0-1067.75|https://launchpad.net/ubuntu/+source/linux-oracle/4.15.0-1067.75]
- linux-image-aws-lts-18.04-4.15.0.1096.99
- [linux-image-4.15.0-1110-azure|https://launchpad.net/ubuntu/+source/linux-azure-4.15]
- [4.15.0-1110.122|https://launchpad.net/ubuntu/+source/linux-azure-4.15/4.15.0-1110.122]
h5。 Ubuntu16.04
linux-image-powerpc-e500mc-4.4.0.206.212
[linux-image-4.4.0-206-powerpc-smp|https://launchpad.net/ubuntu/+source/linux]
[4.4.0-206.238|https://launchpad.net/ubuntu/+source/linux/4.4.0-206.238]
[linux-image-4.4.0-206-powerpc-e500mc|https://launchpad.net/ubuntu/+source/linux]
[4.4.0-206.238|https://launchpad.net/ubuntu/+source/linux/4.4.0-206.238]
[linux-image-4.15.0-1096-aws|https://launchpad.net/ubuntu/+source/linux-aws-hwe]
[4.15.0-1096.103~16.04.1|https://launchpad.net/ubuntu/+source/linux-aws-hwe/4.15.0-1096.103~16.04。 1]
linux-image-generic-hwe-16.04-4.15.0.139.134
[linux-image-4.15.0-139-lowlatency|https://launchpad.net/ubuntu/+source/linux-hwe]
[4.15.0-139.143~16.04.1|https://launchpad.net/ubuntu/+source/linux-hwe/4.15.0-139.143~16.04。 1]
linux-image-virtual-hwe-16.04-4.15.0.139.134
linux-image-virtual-4.4.0.206.212
[linux-image-4.15.0-139-generic-lpae|https://launchpad.net/ubuntu/+source/linux-hwe]
[4.15.0-139.143~16.04.1|https://launchpad.net/ubuntu/+source/linux-hwe/4.15.0-139.143~16.04。 1]
[linux-image-4.4.0-206-generic-lpae|https://launchpad.net/ubuntu/+source/linux]
[4.4.0-206.238|https://launchpad.net/ubuntu/+source/linux/4.4.0-206.238]
linux-image-snapdragon-4.4.0.1152.144
linux-image-powerpc64-smp-4.4.0.206.212
[linux-image-4.15.0-139-generic|https://launchpad.net/ubuntu/+source/linux-hwe]
[4.15.0-139.143~16.04.1|https://launchpad.net/ubuntu/+source/linux-hwe/4.15.0-139.143~16.04。 1]
[linux-image-4.4.0-206-lowlatency|https://launchpad.net/ubuntu/+source/linux]
[4.4.0-206.238|https://launchpad.net/ubuntu/+source/linux/4.4.0-206.238]
linux-image-gke-4.15.0.1095.96
[linux-image-4.4.0-206-powerpc64-smp|https://launchpad.net/ubuntu/+source/linux]
[4.4.0-206.238|https://launchpad.net/ubuntu/+source/linux/4.4.0-206.238]
linux-image-azure-edge-4.15.0.1110.101
[linux-image-4.15.0-1110-azure|https://launchpad.net/ubuntu/+source/linux-azure]
[4.15.0-1110.122~16.04.1|https://launchpad.net/ubuntu/+source/linux-azure/4.15.0-1110.122~16.04。 1]
linux-image-generic-4.4.0.206.212
[linux-image-4.4.0-1124-aws|https://launchpad.net/ubuntu/+source/linux-aws]
[4.4.0-1124.138|https://launchpad.net/ubuntu/+source/linux-aws/4.4.0-1124.138]
linux-image-oem-4.15.0.139.134
linux-image-aws-4.4.0.1124.129
linux-image-kvm-4.4.0.1090.88
linux-image-powerpc-smp-4.4.0.206.212
linux-image-generic-lpae-4.4.0.206.212
[linux-image-4.4.0-206-powerpc64-emb|https://launchpad.net/ubuntu/+source/linux]
[4.4.0-206.238|https://launchpad.net/ubuntu/+source/linux/4.4.0-206.238]
linux-image-gcp-4.15.0.1095.96
linux-image-lowlatency-hwe-16.04-4.15.0.139.134
标准系统更新后,您需要重新启动计算机才能进行
所有必要的更改。
注意:由于不可避免的 ABI 更改,内核更新具有
被赋予了新的版本号,需要重新编译
重新安装您可能已安装的所有第三方内核模块。
除非您手动卸载了标准内核元数据包
(例如 linux-generic,linux-generic-lts-RELEASE,linux-virtual,
linux-powerpc),标准系统升级会自动执行
这个也是。
h2。参考文献
- [CVE-2021-27365|https://people.canonical.com/~ubuntu-security/cve/CVE-2021-27365]
- [CVE-2021-27363|https://people.canonical.com/~ubuntu-security/cve/CVE-2021-27363]
- [CVE-2021-27364|https://people.canonical.com/~ubuntu-security/cve/CVE-2021-27364]
用于降价(wiki 格式)。它将在未来可用。此功能在 Azure DevOps 团队的交付计划中:Azure DevOps Feature Timeline
全部
下面是创建工作项的代码。
字符串描述中的“\r\n”无法识别,所以新建项目的描述文字在一行。
如何用代码创建多行描述的工作项,谢谢。
public static WorkItem CreateWorkItem(VssConnection connection, string title, string type, string description, string tags)
{
string project = "xxx";
// Construct the object containing field values required for the new work item
JsonPatchDocument patchDocument = new JsonPatchDocument();
patchDocument.Add(
new JsonPatchOperation()
{
Operation = Operation.Add,
Path = "/fields/System.Title",
Value = title
}
);
patchDocument.Add(
new JsonPatchOperation()
{
Operation = Operation.Add,
Path = "/fields/System.Description",
Value = description
}
);
// Get a client
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
// Create the new work item
WorkItem newWorkItem = workItemTrackingClient.CreateWorkItemAsync(patchDocument, project, type).Result;
Console.WriteLine("Created work item ID {0} {1}", newWorkItem.Id, newWorkItem.Fields["System.Title"]);
return newWorkItem;
}
使用 <br>
而不是 \r\n
。 Powershell 示例:
$pat = '<pat>'
$url = 'https://dev.azure.com/<org>/<project>/_apis/wit/workitems/$Task?api-version=6.1-preview.3'
$body = '[{"op":"add","path":"/fields/System.Title","from":null,"value":"Sample task"}, {"op":"add","path":"/fields/System.Description","from":null,"value":"my line1<br>my line2<br>my line3"}]'
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f "",$pat)))
Invoke-RestMethod -Uri $url -Method Post -ContentType "application/json-patch+json" -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -Body $body
结果:
另外,能否在描述中正确显示Wiki格式?
wiki 格式示例:
h1。 USN-4883-1:Linux 内核漏洞
2021 年 3 月 20 日
Linux 内核中修复了几个安全问题。
h2。发布
- [Ubuntu 18.04 LTS|https://ubuntu.com/security/notices?release=bionic]
- [Ubuntu 16.04 LTS|https://ubuntu.com/security/notices?release=xenial]
- [Ubuntu 14.04 ESM|https://ubuntu.com/security/notices?release=trusty]
h2。包裹
- [linux|/security/cve?package=linux]
-
- Linux内核
- [linux-aws|/security/cve?package=linux-aws]
-
- Linux Amazon Web Services (AWS) 系统内核
- [linux-aws-hwe|/security/cve?package=linux-aws-hwe]
-
- Linux Amazon Web Services (AWS-HWE) 系统内核
- [linux-azure|/security/cve?package=linux-azure]
-
- Linux Microsoft Azure 云系统内核
- [linux-azure-4.15|/security/cve?package=linux-azure-4.15]
-
- Linux Microsoft Azure 云系统内核
- [linux-gcp|/security/cve?package=linux-gcp]
-
- Linux Google 云平台 (GCP) 系统的内核
- [linux-gcp-4.15|/security/cve?package=linux-gcp-4.15]
-
- Linux Google 云平台 (GCP) 系统的内核
- [linux-hwe|/security/cve?package=linux-hwe]
-
- Linux 硬件支持 (HWE) 内核
- [linux-kvm|/security/cve?package=linux-kvm]
-
- Linux 云环境内核
h2。详情
Adam Nichols 发现 iSCSI 子系统中存在堆溢出
在 Linux 内核中。本地攻击者可以使用它来拒绝
服务(系统崩溃)或可能执行任意代码。 (
[CVE-2021-27365|/security/CVE-2021-27365]
Adam Nichols 发现 Linux 内核中的 iSCSI 子系统
没有正确限制对 iSCSI 传输句柄的访问。本地攻击者
可以利用此问题导致拒绝服务或暴露敏感信息
(内核指针地址)。 (
[CVE-2021-27363|/security/CVE-2021-27363]
Adam Nichols 发现 iSCSI 中存在越界读取
Linux 内核中的子系统。本地攻击者可以利用它造成
拒绝服务(系统崩溃)或暴露敏感信息(内核
内存)。 (
[CVE-2021-27364|/security/CVE-2021-27364]
h2。更新说明
可以通过将您的系统更新到以下软件包版本来解决该问题:
h5。 Ubuntu18.04
- [linux-image-4.15.0-1081-raspi2|https://launchpad.net/ubuntu/+source/linux-raspi2]
- [4.15.0-1081.86|https://launchpad.net/ubuntu/+source/linux-raspi2/4.15.0-1081.86]
- linux-image-powerpc-e500mc-4.15.0.139.126
- [linux-image-4.15.0-1096-aws|https://launchpad.net/ubuntu/+source/linux-aws]
- [4.15.0-1096.103|https://launchpad.net/ubuntu/+source/linux-aws/4.15.0-1096.103]
- [linux-image-4.15.0-139-lowlatency|https://launchpad.net/ubuntu/+source/linux]
- [4.15.0-139.143|https://launchpad.net/ubuntu/+source/linux/4.15.0-139.143]
- linux-image-gcp-lts-18.04-4.15.0.1095.113
- [linux-image-4.15.0-1087-kvm|https://launchpad.net/ubuntu/+source/linux-kvm]
- [4.15.0-1087.89|https://launchpad.net/ubuntu/+source/linux-kvm/4.15.0-1087.89]
- linux-image-oracle-lts-18.04-4.15.0.1067.77
- [linux-image-4.15.0-1095-gcp|https://launchpad.net/ubuntu/+source/linux-gcp-4.15]
- [4.15.0-1095.108|https://launchpad.net/ubuntu/+source/linux-gcp-4.15/4.15.0-1095.108]
- linux-image-virtual-4.15.0.139.126
- [linux-image-4.15.0-139-generic-lpae|https://launchpad.net/ubuntu/+source/linux]
- [4.15.0-139.143|https://launchpad.net/ubuntu/+source/linux/4.15.0-139.143]
- linux-image-金鱼草-4.15.0.1098.101
- linux-image-powerpc64-emb-4.15.0.139.126
- [linux-image-4.15.0-1067-oracle|https://launchpad.net/ubuntu/+source/linux-oracle]
- [4.15.0-1067.75|https://launchpad.net/ubuntu/+source/linux-oracle/4.15.0-1067.75]
- linux-image-aws-lts-18.04-4.15.0.1096.99
- [linux-image-4.15.0-1110-azure|https://launchpad.net/ubuntu/+source/linux-azure-4.15]
- [4.15.0-1110.122|https://launchpad.net/ubuntu/+source/linux-azure-4.15/4.15.0-1110.122]
h5。 Ubuntu16.04
linux-image-powerpc-e500mc-4.4.0.206.212
[linux-image-4.4.0-206-powerpc-smp|https://launchpad.net/ubuntu/+source/linux]
[4.4.0-206.238|https://launchpad.net/ubuntu/+source/linux/4.4.0-206.238]
[linux-image-4.4.0-206-powerpc-e500mc|https://launchpad.net/ubuntu/+source/linux]
[4.4.0-206.238|https://launchpad.net/ubuntu/+source/linux/4.4.0-206.238]
[linux-image-4.15.0-1096-aws|https://launchpad.net/ubuntu/+source/linux-aws-hwe]
[4.15.0-1096.103~16.04.1|https://launchpad.net/ubuntu/+source/linux-aws-hwe/4.15.0-1096.103~16.04。 1]
linux-image-generic-hwe-16.04-4.15.0.139.134
[linux-image-4.15.0-139-lowlatency|https://launchpad.net/ubuntu/+source/linux-hwe]
[4.15.0-139.143~16.04.1|https://launchpad.net/ubuntu/+source/linux-hwe/4.15.0-139.143~16.04。 1]
linux-image-virtual-hwe-16.04-4.15.0.139.134
linux-image-virtual-4.4.0.206.212
[linux-image-4.15.0-139-generic-lpae|https://launchpad.net/ubuntu/+source/linux-hwe]
[4.15.0-139.143~16.04.1|https://launchpad.net/ubuntu/+source/linux-hwe/4.15.0-139.143~16.04。 1]
[linux-image-4.4.0-206-generic-lpae|https://launchpad.net/ubuntu/+source/linux]
[4.4.0-206.238|https://launchpad.net/ubuntu/+source/linux/4.4.0-206.238]
linux-image-snapdragon-4.4.0.1152.144
linux-image-powerpc64-smp-4.4.0.206.212
[linux-image-4.15.0-139-generic|https://launchpad.net/ubuntu/+source/linux-hwe]
[4.15.0-139.143~16.04.1|https://launchpad.net/ubuntu/+source/linux-hwe/4.15.0-139.143~16.04。 1]
[linux-image-4.4.0-206-lowlatency|https://launchpad.net/ubuntu/+source/linux]
[4.4.0-206.238|https://launchpad.net/ubuntu/+source/linux/4.4.0-206.238]
linux-image-gke-4.15.0.1095.96
[linux-image-4.4.0-206-powerpc64-smp|https://launchpad.net/ubuntu/+source/linux]
[4.4.0-206.238|https://launchpad.net/ubuntu/+source/linux/4.4.0-206.238]
linux-image-azure-edge-4.15.0.1110.101
[linux-image-4.15.0-1110-azure|https://launchpad.net/ubuntu/+source/linux-azure]
[4.15.0-1110.122~16.04.1|https://launchpad.net/ubuntu/+source/linux-azure/4.15.0-1110.122~16.04。 1]
linux-image-generic-4.4.0.206.212
[linux-image-4.4.0-1124-aws|https://launchpad.net/ubuntu/+source/linux-aws]
[4.4.0-1124.138|https://launchpad.net/ubuntu/+source/linux-aws/4.4.0-1124.138]
linux-image-oem-4.15.0.139.134
linux-image-aws-4.4.0.1124.129
linux-image-kvm-4.4.0.1090.88
linux-image-powerpc-smp-4.4.0.206.212
linux-image-generic-lpae-4.4.0.206.212
[linux-image-4.4.0-206-powerpc64-emb|https://launchpad.net/ubuntu/+source/linux]
[4.4.0-206.238|https://launchpad.net/ubuntu/+source/linux/4.4.0-206.238]
linux-image-gcp-4.15.0.1095.96
linux-image-lowlatency-hwe-16.04-4.15.0.139.134
标准系统更新后,您需要重新启动计算机才能进行
所有必要的更改。
注意:由于不可避免的 ABI 更改,内核更新具有
被赋予了新的版本号,需要重新编译
重新安装您可能已安装的所有第三方内核模块。
除非您手动卸载了标准内核元数据包
(例如 linux-generic,linux-generic-lts-RELEASE,linux-virtual,
linux-powerpc),标准系统升级会自动执行
这个也是。
h2。参考文献
- [CVE-2021-27365|https://people.canonical.com/~ubuntu-security/cve/CVE-2021-27365]
- [CVE-2021-27363|https://people.canonical.com/~ubuntu-security/cve/CVE-2021-27363]
- [CVE-2021-27364|https://people.canonical.com/~ubuntu-security/cve/CVE-2021-27364]
用于降价(wiki 格式)。它将在未来可用。此功能在 Azure DevOps 团队的交付计划中:Azure DevOps Feature Timeline