THIS came closest to what I'm facing, but their solution doesn't do the trick. Also it's 2.5 years old, so maybe there've been some changes on the API so I'm opening a new question.
Here's my manifest:
{
"targets": [
{
"id": "Microsoft.VisualStudio.Services"
}
],
"scopes": [
"vso.work_full",
"vso.project_manage",
"vso.profile",
"vso.graph",
"vso.identity"
],
"categories": [
"Azure Boards"
],
"demands": [
"api-version/6.0"
],
...
"contributions": [
{
"id": "",
"type": "ms.vss-web.hub",
"targets": [
"ms.vss-work-web.work-hub-group"
]
}
]
}
and my code:
import { getClient } from 'azure-devops-extension-api';
import { WorkItem, WorkItemExpand, WorkItemTrackingRestClient } from 'azure-devops-extension-api/WorkItemTracking';
export class WorkItemsService {
...
static async getWorkItems(ids: number[], projectId: string): Promise<WorkItem[]> {
const client = getClient(WorkItemTrackingRestClient);
...
client.getWorkItems(ids.slice(...), projectId, undefined, undefined, WorkItemExpand.All));
...
}
}
I'm:
- using the WorkItemTrackingRestClient's
getWorkItemsmethod see - setting
WorkItemExpand.Allin the request - not listing any field names in the request
- setting
vso.work_fullin the manifest see
However I'm only getting these fields back:
"System.Id": "",
"System.AreaId": "",
"System.AreaPath": "",
"System.TeamProject": "",
"System.NodeName": "",
"System.AreaLevel1": "",
"System.Rev": "",
"System.AuthorizedDate": "",
"System.RevisedDate": "",
"System.IterationId": "",
"System.IterationPath": "",
"System.IterationLevel1": "",
"System.IterationLevel2": "",
"System.WorkItemType": "",
"System.State": "",
"System.Reason": "",
"System.AssignedTo": "",
"System.CreatedDate": "",
"System.CreatedBy": "",
"System.ChangedDate": "",
"System.ChangedBy": "",
"System.AuthorizedAs": "",
"System.PersonId": "",
"System.Watermark": "",
"System.CommentCount": "",
"System.Title": "",
"Microsoft.VSTS.Common.StateChangeDate": "",
"Microsoft.VSTS.Common.ActivatedDate": "",
"Microsoft.VSTS.Common.ActivatedBy": "",
"Microsoft.VSTS.Common.Priority": "",
"System.Parent": ""
But interestingly when I put the URL from the ApiWorkItem._links.fields in a browser I get a humongous data set with all the fields I'm interested in and then some, similar to this. Case in point, Microsoft.VSTS.Scheduling.xxxx. In the native method's data it's nowhere to be seen but in the JSON returned by the URL there's a bunch of fields.
When instead of undefined I put for example Effort as in Microsoft.VSTS.Scheduling.Effort, like so
client.getWorkItems(ids.slice(...), projectId, ['Effort']);
the results' fields turn out empty.
I don't feel like making hundreds of API calls to get the data I need from the work items' URLs. What am I missing?
I appreciate anyone who read this far.