1
votes

Can any one tell me how i can make deep queries with the TFS API and to avoid to query the TFS database(miscrofot said that is not a best thing).

I'll explain my idea below:
I have a tree like that

  $/tfs/ProjectNameXX/Version/1/SR/SR0 (subdirectory)
                                   SR1 (subdirectory)

How i can make a simple query with the API for retrieve for example:

  • the version of the ProjectNameXX
  • SRs of the ProjectNameXX where the version equals to 1 and "project name" = ProjectNameXX

I have made some methods to retrieve data like the example above but it's not a good thing because if the structure of the tree is changed :nothing is going to work.

Thanks

1

1 Answers

0
votes

I'm presuming you're talking about source control and not areas.

TfsTeamProjectCollection tpc = new TfsTeamProjectCollection("http://url");
VersionControlServer _versionControlServer = tpc.GetService<VersionControlServer>();
versionControlServer.GetItems("$//tfs/*.*", VersionSpec.Latest, RecursionType.Full, DeletedState.NonDeleted, ItemType.File).Items;

That will get your a list of all files recursively, you'll then have to iterate through them manually to figure out what you want.

But yes you'll still have issues if the structure changes.