TFS Version Control workspace structure

hi

Is there any API or Sample to get folders and files in project I try to write a small program working as Source Control Explorer, but I can only list the project under workspace. Here is my test program

tfs = TeamFoundationServerFactory.GetServer();
versionControl = (VersionControlServer)tfs.GetService(typeof(VersionControlServer));
Workspace workspace = versionControl.GetWorkspace("Administrator", versionControl.AuthenticatedUser);

foreach (TeamProject teamProject in versionControl.GetAllTeamProjects(true) )
{
treeView1.Nodes.Add(teamProject.Name);
treeView1.Sort();
}



Answer this question

TFS Version Control workspace structure

  • Scratchc0der

    G'day,

    I am not quite sure I understood what you meant. If you are talking about getting workspace mappings, you can use Workspace.Folders property. WorkingFolder collection returned there will give you a pair of local folder/server folder for each mapping.

    If you are talking about Version Control folders, then it whats you need is VersionControlItems GetItems method; simplest overload that gives you the whole tree is GetItems("$/", RecursionType.Full).

    But if you are talking about Visual Studio project structure, that's Visual Studio extensibility question, not TFS.

    Hope that helps. Yours truly,

     

     



  • ctlatd2

    Buck's example is the best we've got right now, as far as I know. Martin Woodward might know of more resources.

  • bagira

    Thank you for your kindly reply and I am sorry about my stupid question. It really useful. In fact, I am trying to find Version Control folders. But the only way I can find is to create a mapping and get the local folder. It really help that I can use GetItems() to find server folders without mapping to local site.

    so....may i ask a further question How can i learn more about the architecture of Version Control and Version Control API I've had download VSSDKApril2006 but i am still very confuse.Is there any book or web site that I can study


  • Puneet Sarda

    G'day,

    Not sure that there is anyone out there that dedicates all of his time to educating people about TFS Version Control.

    But if I were you I would do the following:

    1. Make "tfs vc object model help" [which is available in "...\Visual Studio 2005 SDK\2006.03\VisualStudioTeamSystemIntegration\Version Control" folder after SDK installation] my Bible and starting point. The object model is fairly well designed and if you want to create workspace, you search for Workspace in help doc, and you find that there is CreateWorkspace method out there (kinda ye-seek-and-ye-shall-find approach) and voila!

    2. Read some of MS devs blogs for examples and insights on Version Control object model; i would go for Buck Hodges', James Manning's and Robert Horvick's blogs; some examples there are pretty advanced for the beginner, but any information out there is valuable at the time

    3. Start coding and get some on hands experience; and ask around! The community people are nice, this newsgroup might be a start.

    Hope that helps. And thanks for the idea - I think if I have time I would start posting some code we have developed as examples, to fill the gap.

    Yours truly,



  • TFS Version Control workspace structure