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.

[151 byte] By [MichaelSabbag] at [2008-2-17]
# 1

Hi Michael,

You can get to this by navigating the Links collection of the WorkItem object.

Cheers

ChandruR at 2007-9-9 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - Work Item Tracking...
# 2

Hi,

Can you post an example?

Thanks

MichaelSabbag at 2007-9-9 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - Work Item Tracking...
# 3

It maybe something like this:

for (int i = 0; i < workitem.Links.Count; i++)
{
Link link = workitem.LinksIdea;
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.

ValeryTolkov at 2007-9-9 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - Work Item Tracking...
# 4
The Idea sign is actually index i in square brackets.
ValeryTolkov at 2007-9-9 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - Work Item Tracking...
# 5
Does this sample work? I can't get to RegisteredLinks "due to its protection level".
Any ideas?
thys at 2007-9-9 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - Work Item Tracking...

Visual Studio Team System

Site Classified