I have TFS url, and I have source File location, but I don’t have Workspace path.
How to Check out file without workspace, or how to find workspace for some file?
I already make solution for checkout file in TFS, but in some cases I don’t have workspace path or name.
Dim TeamFoundationServerURL As String ="TFS url"
Dim TeamProjectCollection As TfsTeamProjectCollection
'Get project collectio
TeamProjectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection( _
New Uri(TeamFoundationServerURL), New UICredentialsProvider())
TeamProjectCollection.EnsureAuthenticated()
Dim Workspace As Workspace
' get Version Control
Dim VersionControlServer As VersionControlServer
VersionControlServer = TeamProjectCollection.GetService(Of VersionControlServer)()
'location to check out files to:
Dim WorkspacePath As String = "__I dot have this path ___"
'find workspace
Workspace = VersionControlServer.GetWorkspace(WorkspacePath)
'Check out file
Workspace.PendEdit(SorceFilePath)
Thanks
Check out without a workspace is not possible. So if you need to check out and don’t have any workspace information – you should create a wokspace on demand.
There’s also an option to get file downloaded without a workspace VersionControlServer.DownloadFile. See http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.versioncontrol.client.versioncontrolserver.downloadfile(v=vs.80).aspx for details. It will not be checked out though (like “view” console command).