How to map the URL of a TFS element to visible

We programmatically generate deployment emails based on the history of change sets and related work items since the last deployed build. They look a bit like assembly summary information inside Visual Studio (but with many assemblies).

The data has useful URLs (e.g. vstfs:///VersionControl/Changeset/205151 ), but being new to the TFS SDK, I do not do if / how it maps to the visible element (e.g. http: // tfsserver : port / somepath / ...). Assembly summary links inside Visual Studio are clickable, but are they VS-only links?

If possible, we want to include links in the email that opens the related item (in the browser?), So I think I need to know if the TFS paths are web-searchable, and if so, how?

Suggestions are welcome. Thanks.

+6
source share
4 answers

This is the uRl that I used to access work items,

=> http://ServerName:PortNumber/tfs/web/wi.aspx?id=xxidxx

Edit The format I specified works with TFS 2010. It basically generates the path to the work item in the web view. Clicking on it opens a work item in a web view.

Alternatively, you can also get the navigation URL programmatically.

 var tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("TFSURL")); var versionControl = tfs.GetService<ICommonStructureService>(); var projects = versionControl.ListAllProjects(); var myService = tfs.GetService<TswaClientHyperlinkService>(); var myUrl = myService.GetChangesetDetailsUrl(21); 

Thus, the TswaClientHyperlinkService service is a Microsoft hyperlink service. This will create url formats for the absolute path, relative path, path and query, blah blah.

Hth,

Cheers, Tarun

PS I hate making mistakes !!! hahaha ... enter image description here

EDIT And since you have a URI in your case and you are already using the TFS API, these two lines of code will do the trick.

 var testManagementService = tfs.GetService<ILinking>(); var testControllers = testManagementService.GetArtifactUrl(@"vstfs:///VersionControl/Changeset/205151"); 

This will create https://ServerName:PortNumber/defaultcollection/VersionControl/Changeset.aspx?artifactMoniker=205151

NTN

Cheers, Tarun

+13
source

Vstfs links are called "artifact identifiers" and are internal data in TFS that is expected to be consumed only by the TFS client. The TFS client will analyze this data and determine how to display this data. To reference the change set that you provide, rich clients will open a dialog with the details of the change set. The web client translates this link into a URI. And various TFS libraries can provide you more data about this artifact using this identifier.

If you want to create your own link to TFS Web Access, the strictly correct way to do this is to request some information on the server. Once you have the TswaClientHyperlinkService service, you can request web access URIs for various services, such as viewing a set of changes or viewing a work item. Some examples are shown on Martin Woodward's blog .

+3
source

TFS2012 must have an additional pcguid URL pcguid . Here's a new format that extends the good solution given by @TarunArora:

http://ServerName:PortNumber/tfs/web/wi.aspx?pcguid=xxguidxx&id=xxidxx

This blog post describes how to find pcguid through Visual Studio.

However, if you, like me, try to use TFS without installing Visual Studio (don’t ask!), An alternative using the browser-based TFS interface is used here:

  • Go to the "Open Issues" section.
  • Click the button that looks like an envelope ("Send request as letter") in the upper right corner of the work item panel.
  • Right-click on one of the links in the letter and copy the location of the link.
  • Cancel sending email without sending.
  • Paste the link into a text editor and extract the pcguid value.
0
source

Source: https://habr.com/ru/post/891285/


All Articles