2012-07-21 111 views
2

我目前在Outlook中做了一个插件,并且我想让它使用指定的模板(bug/task/etc)打开一个工作项并填充一些字段。我无法弄清楚如何调用UI。 (这将是像你在Excel中并导入到TFS和你的项目不验证,所以它打开UI中的工作项目时)。以编程方式打开TFS Workitem UI

命名空间或代码将不胜感激。

回答

2

,我看到了隐藏的“复制模板网址”按钮,该解决方案是我用的网址:

http://tfsportal.com/CompanyName/ProjectName/_layouts/tswa/UI/Pages/WorkItems/WorkItemEdit.aspx < - 不显示的按钮。

http://tfs.CompanyNameURL:8080/tfs/web/wi.aspx? < - 确实显示按钮

然后,一旦你获得的网址,你可以很容易地Shell the process in .Net。例如:

string URL = the TFSWorkItemURLYouGotFromThewi.aspxPageWithQueryStrings 
Process.Start(URL): 

只是供参考:另一种方法是使用Process类的一个实例。这允许更多的控制过程,包括调度,它将运行的窗口的类型,对我来说最有用的是等待过程完成的能力。

Process process = new Process(); 
// Configure the process using the StartInfo properties. 
process.StartInfo.FileName = "process.exe"; 
process.StartInfo.Arguments = "-n"; 
process.StartInfo.WindowStyle = ProcessWindowStyle.Maximized; 
process.Start(); 
process.WaitForExit();// Waits here for the process to exit.