我们可以将 Azure DevOps 工作项文件导出到 Excel 中吗

发布于 2025-01-13 13:13:17 字数 130 浏览 4 评论 0原文

我们在 Azure DevOps Board 中有不同类型的工作项。我们需要将工作项中所有字段的列表导出到 Excel 或任何类似的格式。有没有办法使用 API 来提取系统中所有字段的列表以及任何可用的相关元数据?有人可以帮助我们完成这项任务吗?

We have different types of work items in Azure DevOps Boards. We need to export list of all fields in work items to excel or any similar format. Is there a way to use the APIs to pull a list of all fields in the system and whatever associated metadata is available? Can someone please help us on this task.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

腹黑女流氓 2025-01-20 13:13:17

您可以使用适用于 Excel 的 Azure DevOps Office® Integration 2019 连接器来批量提取数据。调用 API 有一个限制,我认为可能是 10,000 个工作项。当您使用条件运行查询时,您可以通过划分查询来绕过此速率限制。

You can use the Azure DevOps Office® Integration 2019 connector for Excel to extract data in volume. There is a limit for calling the API I think it might be 10,000 work items. you can get around this rate limit by dividing your query up when you run it with a criteria.

辞旧 2025-01-20 13:13:17

如果您有 Visual Studio,则可以运行开发人员命令提示符并使用 witadmin 命令行。

输入图片此处描述

witadmin listfields /collection:https://dev.azure.com/<org>

Witadmin 语法:https: //learn.microsoft.com/en-us/azure/devops/reference/witadmin/manage-work-item-fields?view=azure-devops#syntax

If you have Visual Studio, you can run Developer Command Prompt and use witadmin command line.

enter image description here

witadmin listfields /collection:https://dev.azure.com/<org>

Witadmin syntax: https://learn.microsoft.com/en-us/azure/devops/reference/witadmin/manage-work-item-fields?view=azure-devops#syntax

心舞飞扬 2025-01-20 13:13:17

您可以使用 Rest Api 获取表单流程模板的所有字段: https://learn.microsoft.com/en-us/rest/api/azure/devops/processes/fields/list?view=azure-devops-rest-7.1

Powershell 示例:

$user = ""
$token = "<pat>" #https://learn.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate

$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $user,$token)))
$orgUrl = "https://dev.azure.com/<org>"
$procId = "<proc-guid>"
$wiRefName = "<wi type name>"

$restApiGetFields = "$orgUrl/_apis/work/processes/$procId/workItemTypes/$wiRefName/fields?api-version=7.1-preview.2"

function InvokeGetRequest ($GetUrl)
{   
    return Invoke-RestMethod -Uri $GetUrl -Method Get -ContentType "application/json" -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)}
}

$fields = InvokeGetRequest $restApiGetFields

foreach ($wifield in $fields.value)
{
    Write-Host "Name:" $wifield.name "; RefName" $wifield.referenceName
}

进程会引导您可以通过rest API: https://dev.azure.com//_apis/work/processes?api-version=7.1-preview.2

在此处输入图像描述

查看流程模板时可以从 URL 获取工作项类型名称:

在此处输入图像描述

更新:

要获取有关每个字段的信息,您需要使用 字段获取 带有 $expand=all 选项的 REST API。

例子:
输入图片此处描述

You can use Rest Api to get all fields form process template: https://learn.microsoft.com/en-us/rest/api/azure/devops/processes/fields/list?view=azure-devops-rest-7.1

Powershell example:

$user = ""
$token = "<pat>" #https://learn.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate

$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $user,$token)))
$orgUrl = "https://dev.azure.com/<org>"
$procId = "<proc-guid>"
$wiRefName = "<wi type name>"

$restApiGetFields = "$orgUrl/_apis/work/processes/$procId/workItemTypes/$wiRefName/fields?api-version=7.1-preview.2"

function InvokeGetRequest ($GetUrl)
{   
    return Invoke-RestMethod -Uri $GetUrl -Method Get -ContentType "application/json" -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)}
}

$fields = InvokeGetRequest $restApiGetFields

foreach ($wifield in $fields.value)
{
    Write-Host "Name:" $wifield.name "; RefName" $wifield.referenceName
}

Process guild you can get through rest API: https://dev.azure.com/<you_org_name>/_apis/work/processes?api-version=7.1-preview.2

enter image description here

Work Item Type Name you can get from URL while viewing your process template:

enter image description here

UPDATE:

To get information about each field, you need to use FIELD GET rest API with $expand=all option.

Example:
enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文