Get all changesets number that linked to work items
Hi,
How can I get the list of all the changesets that linked to a specific work item
with the API?
Thanks,
Michael.
Hi,
How can I get the list of all the changesets that linked to a specific work item
with the API?
Thanks,
Michael.
Hi Michael,
You can get to this by navigating the Links collection of the WorkItem object.
Cheers
It maybe something like this:
for (int i = 0; i < workitem.Links.Count; i++)
{
Link link = workitem.Links
;
ExternalLink elink = link as ExternalLink;
if (elink != null && elink.ArtifactLinkType.Name == RegisteredLinks.Changeset)
{
Console.WriteLine("{0}", elink.LinkedArtifactUri);
}
}
The printed lines will be look like "vstfs:///VersionControl/Changeset/9999", where 9999 - changeset number.
You can use System.Uri class to extract changeset from link Uri.