title: How do you get the latest version of source code using the Team Foundation Server SDK?
body: <p>I'm attempting to pull the latest version of source code out of TFS programmatically using the SDK, and what I've done somehow does not work:</p>
  
  <pre><code>string workspaceName = "MyWorkspace";
  string projectPath = "/TestApp";
  string workingDirectory = "C:\Projects\Test\TestApp";
  
  VersionControlServer sourceControl; // actually instantiated before this method...
  
  Workspace[] workspaces = sourceControl.QueryWorkspaces(workspaceName, sourceControl.AuthenticatedUser, Workstation.Current.Name);
  if (workspaces.Length &gt; 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 doesn't do anything - no failures or errors
  }
  finally
  {
      if (workspace != null)
      {
          workspace.Delete();
      }
  }
  </code></pre>
  
  <p>The approach is basically creating a temporary workspace, using the <code>Get()</code> method to grab all the items for this project, and then removing the workspace. Is this the correct way to do this? Any examples would be helpful.</p>