I am trying to create a workspace and map a folder to my local drive, I want a single file to be mapped to my drive (I am not able to get single or full folder as well in my local drive)
Info: TFS 2015 .Net Framework 4.6.1 Visual studio 2017
I put 2 copies of code but both are not working. No idea why? Searching for solution since couple of days please help.
Here is my Code
Version 1:
<pre lang="c#">sFromFullPath = "$/ProjectName/Main/Sub.Folder1/Sub.Folder2/Sub.Folder3/FileToBeDownaded.cs";
Workspace workspace = null;
string localPath = "C:\\ProjectNameLocal\\" + sFromFullPath.Substring(2, (sFromFullPath.LastIndexOf('/') - 1)).Replace('/', '\\');
if (Directory.Exists(localPath) == false) Directory.CreateDirectory(localPath);
workspace= versionControlServer.GetWorkspace("TFSWORKSPACE", versionControlServer.AuthenticatedUser.ToString());
if(workspace==null) workspace = versionControlServer.CreateWorkspace("TFSWORKSPACE");
workspace.Map(sFromFullPath, localPath);
workspace.Get();<pre>
Version 2:
workspace.CreateMapping(new WorkingFolder(sFromFullPath, localPath));
workspace.Get();
If posssible want to have a single file only which user has selected, but I am not able to get the file or the whole folder as well in my local drive.
//when I check this varible it is false means my mapping is not happening at all
var newbol = workspace.IsLocalPathMapped(localPath);
Am I missing something?
What I have tried:
1) I tried using local and server folder directly in workspace.map(serverpath.localpath) 2) I tried using workspace.createmapping(new workingFolder(serverpat,localpath))
do i need to include the path without file? Please help me. I am searching for the answer since long. Stackoverflow is also not able to answer.