Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- GET https://{account}.visualstudio.com/{project}/_apis/wit/workitems/{id}?$expand=Relations&api-version=5.0-preview.3
- using System;
- using Microsoft.VisualStudio.Services.Client;
- using Microsoft.VisualStudio.Services.WebApi;
- using Microsoft.TeamFoundation.WorkItemTracking.WebApi;
- using Microsoft.TeamFoundation.WorkItemTracking.WebApi.Models;
- namespace GetWorkItemFullyExpanded
- {
- class Program
- {
- static void Main(string[] args)
- {
- GetWorkItemFullyExpanded();
- }
- public static WorkItem GetWorkItemFullyExpanded()
- {
- int id = xx;
- var myCredentials = new VssClientCredentials();
- var connection = new VssConnection(new Uri(@"https://xxxx.visualstudio.com"), myCredentials);
- WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
- WorkItem workitem = workItemTrackingClient.GetWorkItemAsync(id, expand: WorkItemExpand.Relations).Result;
- Console.WriteLine(workitem.Id);
- Console.WriteLine("Relations: ");
- foreach (var relation in workitem.Relations)
- {
- if (relation.Rel == "Microsoft.VSTS.Common.TestedBy-Forward")
- Console.WriteLine(relation.Url);
- }
- return workitem;
- }
- }
- }
Add Comment
Please, Sign In to add comment