2010-05-13 51 views
0

我想設置最大工作項目附件大小。從舊博客我發現可以通過調用SetMaxAttachmentSize,但博客是爲舊版本的TFS。我已經找到了新的WebService路徑TFS 2010你如何在TFS 2010中設置MaxMaxAttachmentSize?

http://localhost:8080/tfs/_tfs_resources/WorkItemTracking/v1.0/ConfigurationSettingsService.asmx/SetMaxAttachmentSize 

不幸的是,當我這樣稱呼它,我收到此錯誤:This request can only be made against a project collection. The (.asmx) file should be located in the project directory (usually _tfs_resources under the application root).

我不知道如何通過瀏覽器格式化調用目標一個特定的項目集合。有什麼想法嗎?

回答

0

我發現這個工程。這比編寫代碼更容易。

  1. 轉到該網址與你的項目集合替換<Collection>http://localhost:8080/tfs/<Collection>/WorkItemTracking/v1.0/ConfigurationSettingsService.asmx
  2. 選擇SetMaxAttachmentSize

您可以測試,以確保您通過上面去相同的URL,然後選擇GetMaxAttachmentSize正確設置。

1

顯然SetMaxAttachmentSize Web服務並沒有充分利用2010年TFS因此,你需要做到這一點編程,嘗試運行下面的代碼:

TeamFoundationServer tfs = TeamFoundationServerFactory.GetServer(@"http://yourtfsserver:8080/tfs/DefaultCollection"); 
      ITeamFoundationRegistry rw = tfs.GetService<ITeamFoundationRegistry>(); 
      RegistryEntryCollection rc = rw.ReadEntries(@"/Service/WorkItemTracking/Settings/MaxAttachmentSize"); 
      RegistryEntry re = new RegistryEntry(@"/Service/WorkItemTracking/Settings/MaxAttachmentSize", "20971520"); //20MB 
      if (rc.Count != 0) 
      { 
       re = rc.First(); 
       re.Value = "20971520"; 
      } 
      rw.WriteEntries(new List<RegistryEntry>() { re }); 

我希望它爲你工作

問候, 蘭德爾·羅薩萊斯