0

I am downloading the branch from TFS using the below code :-

        TeamFoundationServer tfs = new TeamFoundationServer("URL", System.Net.CredentialCache.DefaultCredentials);
        // tfs server url including the  Collection Name --  CollectionName as the existing name of the collection from the tfs server 
        tfs.EnsureAuthenticated();

        VersionControlServer sourceControl = (VersionControlServer)tfs.GetService(typeof(VersionControlServer));

        Workspace[] workspaces = sourceControl.QueryWorkspaces(workspaceName, sourceControl.AuthenticatedUser, Workstation.Current.Name);
        if (workspaces.Length > 0)
        {
            sourceControl.DeleteWorkspace(workspaceName, sourceControl.AuthenticatedUser);
        }
        Workspace workspace = sourceControl.CreateWorkspace(workspaceName, sourceControl.AuthenticatedUser, "Temporary Workspace");
        try
        {
            workspace.Map(projectPath, workingDirectory);
            GetRequest request = new GetRequest(new ItemSpec(projectPath, RecursionType.Full), VersionSpec.Latest);
            GetStatus status = workspace.Get(request, GetOptions.GetAll | GetOptions.Overwrite); // this line gets the status of request

        }
        finally
        {
            if (workspace != null)
            {
                workspace.Delete();

            }
        }

I want to show the status in ProgressBar but not able to do it. I am even using BackGroundWorker tool. So please help.

Avinash Kumar
  • 167
  • 2
  • 12

1 Answers1

0

Unfortunately, there is no such TFS API can achieve what you need.

As a work around, you can try to use the Progress Indicators in a Windows PowerShell script or a windows batch (cmd) file.

Community
  • 1
  • 1
PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62