I need to build an window application in VS2015 to connect the Team Foundation Server 2015. The user can select the collection from Dialog box then I will list all branches etc.. I found the article Browse items in TFS Version Control programmatically, reposted which may fit my app, but the link for download ItemBrowser doesn't work. Would someone have an example or some link can help me. Thanks in advance.
Asked
Active
Viewed 1,326 times
1
-
https://www.visualstudio.com/en-us/integrate/api/overview – tzachs Apr 06 '16 at 18:30
1 Answers
0
First, you need to connect to TFS using TFS API programmatically.
You are able to use the "Browse" dialog programmatically in your own application via the following code:
VersionControlServer versionControlServer = (VersionControlServer)tfs.GetService(typeof(VersionControlServer));
Assembly controlsAssembly = Assembly.GetAssembly(typeof(Microsoft.TeamFoundation.VersionControl.Controls.ControlAddItemsExclude));
Type vcChooseItemDialogType = controlsAssembly.GetType("Microsoft.TeamFoundation.VersionControl.Controls.DialogChooseItem");
ConstructorInfo ci = vcChooseItemDialogType.GetConstructor(
BindingFlags.Instance | BindingFlags.NonPublic,
null,
new Type[] { typeof(VersionControlServer) },
null);
_chooseItemDialog = (Form)ci.Invoke(new object[] { versionControlServer });
_chooseItemDialog.ShowDialog();
this.DialogResult = _chooseItemDialog.DialogResult;
Then you need to list all branches in the project collection, you can refer below link: How to programmatically get information about branches in TFS? & Get all TFS Branches programmatically in C'#
If you want to download the files and folders from TFS, just see this article: Programmatically Downloading Files From Source Control

Dave Smash
- 2,941
- 1
- 18
- 38

PatrickLu-MSFT
- 49,478
- 5
- 35
- 62
-
I found some article mentioned about TemProjectPicker to collect FTS. What is difference between using TeamProjectPicker and Browse dialog? – user819774 Apr 12 '16 at 14:15
-
The `teamProjectPicker` only provides a dialog to select a collection of TeamFoundation projects. So you can only list projects with this class in the dialog. Details you can refer this blog https://blogs.msdn.microsoft.com/team_foundation/2010/04/20/using-the-teamprojectpicker-api-in-tfs-2010/ If you wan to list custom info such as branch, you may have to use browser dialog. – PatrickLu-MSFT Apr 29 '16 at 07:15