Search code examples
tfstfs-sdk

List Source Control Files and Folder under a given TFS Path (without work-space mapping)


I'm redesigning a control that lists the contents (files and folders) under a given TFS path. The tricky part is that I don't want to create a workspace for achieving this, as my intention is just to list the contents and display the history of a selected item. The current implementation creates a local workspace mapping in the background to achieve this, is this needed? Can I attain this without a local workspace mapping?

Thanks Joe.


Solution

  • Use GetItems, which does not require a workspace. For example:

    TeamFoundationServer tfs = new TeamFoundationServer("http://tfs:8080/tfs/DefaultCollection");   
    VersionControlServer versionControl = tfs.GetService<VersionControlServer>();   
    ItemSet items = versionControl.GetItems(tfsPath, RecursionType.Full);