2010-05-13 62 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 }); 

我希望它为你工作

问候, 兰德尔·罗萨莱斯