Let's say we have a solution in TFS Source Control which has already been mapped to a local folder SolutionFolder.
We are in a sub folder SubFolder of this SolutionFolder.
How can we write C# code to get the mapped path of this SubFolder?
Let's say we have a solution in TFS Source Control which has already been mapped to a local folder SolutionFolder.
We are in a sub folder SubFolder of this SolutionFolder.
How can we write C# code to get the mapped path of this SubFolder?
Copyright © 2021 Jogjafile Inc.
Use the
WorkStation.Currentto grab the information for the folder in question:Import the following namespaces:
and then use you can get to the data you want through:
From there you can easily grab the Workspace as well and from there the serverpath:
workspace.GetWorkspace().GetServerItemForLocalItem()To provide credentials, you can use one of the additional overloads that accepts a
CredentialsProvider. The default provider is theUICredentialsProvider. Or you can also callserverorprojectCollection'sEnsureAuthenticated.See also: