2014-06-20 57 views
-1

我想知道是否有可能讓VBA(Access)打開TFS錯誤報告網頁並填寫說明?以編程方式填寫來自VBA的TFS New Bug工作項目

雖然我可以打開該頁面,但我還沒有找到填充說明和其他字段的方法。

也許其中一位專家知道?

+0

你有什麼要求?數據來自哪裏,你甚至可以自動化bug的人口? – TheNorthWes

+0

我的希望是當捕獲錯誤時,我的訪問數據庫代碼儘可能多地填充TFS頁面。所以數據來自我的訪問代碼(VBA) – GDutton

+0

爲什麼跟蹤訪問中的錯誤而不是TFS? – TheNorthWes

回答

0

的方式我終於做到了是使用DLL 訪問和TFS之間的接口...對於任何人試圖同樣在這裏是代碼...

Imports Microsoft.TeamFoundation.Client 
Imports Microsoft.TeamFoundation.WorkItemTracking.Client 
Imports Microsoft.TeamFoundation.WorkItemTracking.Common 
Imports System.Runtime.InteropServices 

<ComClass(TFSInterOp.ClassId, TFSInterOp.InterfaceId, TFSInterOp.EventsId)> Public Class TFSInterOp 
Public Const ClassId As String = "14306fc5-1492-42d6-a032-bc4348508dd3" 
Public Const InterfaceId As String = "288339cb-0c2e-45fd-8005-e5fed401f0cc" 
Public Const EventsId As String = "723327dc-7777-44e4-b291-9299027665eb" 

Public Sub New() 
End Sub 

Public Function InsertBugWorkItem(Title As String, Desc As String) As String 

    Dim tfsServer As String = My.Settings("TfsFullPath").ToString ' {YOUR TFS SERVER PATH} 
    Dim strAssUser As String = My.Settings("AssignTo").ToString 
    Dim teamFoundationServer1 As Microsoft.TeamFoundation.Client.TfsTeamProjectCollection = Microsoft.TeamFoundation.Client.TfsTeamProjectCollectionFactory.GetTeamProjectCollection(New Uri(tfsServer)) 

    Dim workItemStore1 As New WorkItemStore(teamFoundationServer1) 
    teamFoundationServer1.Authenticate() 
    Dim WorkItemStore As WorkItemStore = New WorkItemStore(tfsServer) 
    Dim tfsProject As Project = WorkItemStore.Projects(0) 
    Dim wIType As WorkItemType = tfsProject.WorkItemTypes("Bug") 
    Dim workItem As WorkItem = New WorkItem(wIType) 
    Dim wiStore = teamFoundationServer1.GetService(Of WorkItemStore)() 
    Dim Project = wiStore.Projects 
    Dim Area = Project.Item(0).AreaRootNodes("BITS").Id ' The project to add the work item to 

    ' Prefill items 
    workItem.Title = Title 
    workItem.Description = Desc 
    workItem.AreaId = Project.Item(0).AreaRootNodes("BITS").Id 
    workItem.Fields("Assigned To").Value = strAssUser 
    workItem.Fields("System Info").Value = "Access V 1.1.25" 
    workItem.Fields("Repro Steps").Value = Desc 

    Dim result As ArrayList = workItem.Validate() 

    If result.Count > 0 Then 
     Return (result(0).ToString + "There was an error adding this work item to the work item repository") 
    Else 
     workItem.Save() 
    End If 

    ' Open the new item in explorer 
    Dim myService = teamFoundationServer1.GetService(Of TswaClientHyperlinkService)() 
    Dim myUrl = myService.GetWorkItemEditorUrl(workItem.Id) 
    Dim oProcess As New System.Diagnostics.Process() 
    oProcess.StartInfo.FileName = myUrl.ToString 
    oProcess.Start() 
    Return "OK" 
End Function 
End Class 
0

我不會嘗試去做你正在做的事情。

一,相信一個錯誤的應用程序來正確報告自己的錯誤不是一個好主意。但除此之外,您將嘗試將Access附加到TFS。

這就是說你可以做到這一點完全自動化。放入一些錯誤陷阱,然後你要做的是如何調用TFS API。但是,你可能會或可能不會有安裝一些第三方工具等

Starting pointTFS API

相關問題