We are programmatically generating deployment emails, based on the history of changesets and associated workitems since the last deployed build. They look a bit like the build summary info inside Visual Studio (but with many builds combined).
There appear to be useful URLs in the data (like vstfs:///VersionControl/Changeset/205151
), but being new to the TFS SDK I do not if/how this maps to a viewable item (e.g. http://tfsserver:port/somepath/...). The build summary links inside Visual Studio are clickable, but are they VS-only links?
If possible we want to include links in the email that open the related item (in a browser?), so I guess I need to know if TFS paths are web-browsable and if so, how?
Suggestions welcomed. Thanks.
This is the uRl i have been using to access work items,
=> http://ServerName:PortNumber/tfs/web/wi.aspx?id=xxidxx
Edit The format i have specified does work with TFS 2010. It basically generates the path to the work item in Web view. Clicking on this opens the work item in the web view.
As an alternate, you could get a navigatable URL programmatically as well.
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);
So, the service "TswaClientHyperlinkService" is microsofts TFS hyperlink service. This will generate the url formats for Absolute path, relative path, Path and Query, blah blah.
HTH,
Cheers, Tarun
PS - I hate to be wrong!!! hahaha...
EDIT And since in your case you have the URI available and you already are using the TFS API, these two lines of code would do the trick.
var testManagementService = tfs.GetService<ILinking>();
var testControllers = testManagementService.GetArtifactUrl(@"vstfs:///VersionControl/Changeset/205151");
This will generate, https://ServerName:PortNumber/defaultcollection/VersionControl/Changeset.aspx?artifactMoniker=205151
HTH,
Cheers, Tarun
The following seems to be the standard url for accessing work items
http://TFS_Name:port_number/WorkItemTracking/Workitem.aspx?artifactMoniker=work_Item_Id
The vstfs links are called "artifact IDs" and are internal data to TFS that is expected to only be consumed by a TFS client. A TFS client will parse that data and determine how to display that data. For a changeset link like you provide, the rich clients will open up a dialog with the changeset details. A web client would translate that link into a URI. And the various TFS libraries are able to provide you more data on this artifact using that ID.
If you wanted to create your own link to TFS Web Access, the strictly proper way to do this is to query some information on the server. Once you have a TswaClientHyperlinkService, you can query for the Web Access URIs for various services, such as view a changeset or view a work item. Some examples are shown on Martin Woodward's blog.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With