2012-09-23 24 views
0

我有一個應該獲得最新到特定日期的項目。我有這樣的代碼:在C#中獲取最新的特定項目

  var serverFolder = pathInTfs; 
      var localFolder = pathInLocalMachin; 
      var workingFolder = new WorkingFolder(serverFolder, localFolder); 
      // Create a workspace mapping 
      workspace.CreateMapping(workingFolder); 

      if (!workspace.HasReadPermission) 
      { 
       throw new SecurityException(
        String.Format("{0} does not have read permission for {1}", 
            versionControl.AuthorizedUser, serverFolder)); 
      } 
      // Get the files from the repository 
      workspace.Get(dateForLatest, GetOptions.Overwrite); 

每一件事情是好的,但我想獲得最新的唯一的目錄「pathInTfs」中的「pathInLocalMachin」,但程序運行時workspace.Get()每個項目將獲得最新的。 如何在我的項目中獲得最新的一條路徑。

回答

2

Get有幾個重載,允許您指定想要獲取的對象集。對於你在做什麼,我想你想要Get(GetRequest, GetOptions)

GetRequest包含一個ItemSpec,您可以在其中指定要獲取的文件夾,然後指示RecursionType.Full

相關問題