Add a work item to an existing project
Posted: Mon Jun 13, 2011 10:24 am
I'm trying to import items from our old work-tracking system (a spreadsheet) into Vault's work items. It seems like this should be easy:
Connect to server
For Each item in spreadsheet
Create new work item
Upload new work item
Next
I'm getting terribly unhelpful 'Null reference exception' errors when I run, though, which aren't giving me any insight into what's actually missing.
[spreadsheet operations elided, for loop elided]
Dim conn As VaultClientNetLib.VaultConnection = New VaultClientNetLib.VaultConnection()
conn.InitService(VaultConnection.AccessLevelType.Client)
conn.InitDragnetService()
conn.Login("http://www.[myserver].com/VaultService", "[username]", "[password]")
Dim item As MantisItem = New MantisItem()
item.ID = nextId ' Value from spreadsheet
iitem.Subject = "Text from spreadsheet"
item.Details = "Text from another column"
item.Custom1 = "Text from a third column"
item.StatusID = StatusVal.Open
item.PriorityID = PriorityVal.Medium
conn.AddItem(item) <-- This line fails with a null reference exception: "Object reference not set to an instance of an object" with stack trace of " at VaultClientNetLib.VaultConnection.AddItem(MantisItem& item)
at ExcelToVaultImporter.frmImporter.btnImport_Click(Object sender, EventArgs e)
in C:\Projects\ExcelToVaultImporter\ExcelToVaultImporter\Importer.vb"
Any idea what I'm doing wrong? The API's lack of documentation is making this harder than it needs to be, and the unexplained mingling of Fortress/Dragnet/Mantis as terms among the various work-item references is not helping. At a bare minimum, it would be very helpful if the API returned an error message indicating whether there was some parameter I'm missing on the MantisItem or something.
Connect to server
For Each item in spreadsheet
Create new work item
Upload new work item
Next
I'm getting terribly unhelpful 'Null reference exception' errors when I run, though, which aren't giving me any insight into what's actually missing.
[spreadsheet operations elided, for loop elided]
Dim conn As VaultClientNetLib.VaultConnection = New VaultClientNetLib.VaultConnection()
conn.InitService(VaultConnection.AccessLevelType.Client)
conn.InitDragnetService()
conn.Login("http://www.[myserver].com/VaultService", "[username]", "[password]")
Dim item As MantisItem = New MantisItem()
item.ID = nextId ' Value from spreadsheet
iitem.Subject = "Text from spreadsheet"
item.Details = "Text from another column"
item.Custom1 = "Text from a third column"
item.StatusID = StatusVal.Open
item.PriorityID = PriorityVal.Medium
conn.AddItem(item) <-- This line fails with a null reference exception: "Object reference not set to an instance of an object" with stack trace of " at VaultClientNetLib.VaultConnection.AddItem(MantisItem& item)
at ExcelToVaultImporter.frmImporter.btnImport_Click(Object sender, EventArgs e)
in C:\Projects\ExcelToVaultImporter\ExcelToVaultImporter\Importer.vb"
Any idea what I'm doing wrong? The API's lack of documentation is making this harder than it needs to be, and the unexplained mingling of Fortress/Dragnet/Mantis as terms among the various work-item references is not helping. At a bare minimum, it would be very helpful if the API returned an error message indicating whether there was some parameter I'm missing on the MantisItem or something.