16

Code:

string spName = "usp_Test_Procedure.sql";
var tfsPp = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false);
tfsPp.ShowDialog();
_tfs = tfsPp.SelectedTeamProjectCollection;
if (tfsPp.SelectedProjects.Any())
{
     _selectedTeamProject = tfsPp.SelectedProjects[0];
}
string selectedProjectName = _selectedTeamProject.Name;
var tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(_tfs.Uri);
var vsStore = tfs.GetService<VersionControlServer>();
var project = "project";
var branchVersion = "1.0.0";
var folders = vsStore.GetItems("$/" + selectedProjectName + "/*", RecursionType.Full);

How to search for a specific file in the source control of TFS inside a particular selected project and also selected branchversion in the dropdown menu by the user from the c# UI winforms application?

Here the file I need to search is usp_Test_Procedure.sql which is present in the following path

$/selectedProjectName/project/1.0.0/UI/Scripts/usp_Test_Procedure.sql

Actually I am getting the above path from the foolowing code:

folders.Items[29956].ServerItem

But I need to know how to search for a specific file in the source control of TFS inside a particular selected project and also selected branchversion? Thanks.

4
  • Can somebody provide me a solution or suggestion how to proceed..Thanks Jul 3, 2014 at 7:21
  • What's the problem with what you're doing? Does it not work? Jul 3, 2014 at 9:38
  • I want to search a file which is present inside the tfs project folder from c# winforms app. I need the full server path of source control and not local mapped path.Thanks. Jul 3, 2014 at 9:45
  • I'm not totally clear what your problem is - can't you just use what you have, maybe in conjunction with the `GetItem' (msdn.microsoft.com/en-us/library/bb138919.aspx) method? Jul 3, 2014 at 9:51

2 Answers 2

46

Install TFS Power Tools, on Source Control windows click with right button on Team Project or branch, on context menu choose Find > Find by Wildcard, just search files by names, not content.

3
2

If you want to search by content and name you can create a workspace and "get" that specific version locally. Then use the built in search in your OS or in Visual Studio to find what you are looking for.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.