Page 1 of 2

How do I start?

Posted: Thu Dec 14, 2017 12:27 pm
by dbaltz
I have Vault Pro 10 and need to port an Excel list of bugs into work items. I have downloaded the API but there doesn't seem to be an installer for the DLLs and VBA in Excel 2010 doesn't find any references to the API. Should it? Is there a primer on getting started installing and working with the API that I haven't found yet? Do I need to install Eclipse? I did find a thread from someone who had successfully done it but the information was sketchy.

Someone please point me to the basic "Getting Started" thread.

Re: How do I start?

Posted: Thu Dec 14, 2017 2:22 pm
by jclausius
I'm uncertain how one could use the API within VBA. If VBA can load and call .NET compiled DLLs, it *might* work. However, I'm uncertain on where to point you.

However, from within a normal .NET based application, there are some samples here - viewtopic.php?f=31&t=8020 using the methods in VaultClientIntegrationLib.ItemTrackingOperations. To create work items from within an application.

You mention you have some information provided by someone. Do you have that info or can you post a link?

Re: How do I start?

Posted: Thu Dec 14, 2017 2:45 pm
by dbaltz
Thank you. That helps to know that they are .NET dlls! So it sounds like I need to write a C# .NET app.

Here is the link to the other thread I found:
viewtopic.php?f=32&t=16138&p=63496&hili ... ems#p63496

Re: How do I start?

Posted: Thu Dec 14, 2017 3:36 pm
by jclausius
Yes, a C# based app should do the trick.

From a quick glance, the link provides a start, but was not setting the "Project" property to a valid project before attempting to Add the item. I believe once the project was set, the OP was able to add the items.

Re: How do I start?

Posted: Thu Dec 14, 2017 6:15 pm
by dbaltz
I have WPF app getting the correct data from the Excel file. Now I just need to add the work items in the correct project folders. I'm totally confused how to do that.
What is a MantisItem or FortressItem? Are those obsolete with Vault Pro 10? What DLL do I need to reference?

Re: How do I start?

Posted: Fri Dec 15, 2017 11:26 am
by jclausius
No. You'll want to use those. Mantis was the 'code name' for Vault Professional work items and Fortress was the original released name. It is a bit confusing, but the MantisItem and any subclasses are used to interact with the Vault Professional Web Service.

Reference the VaultClientIntegrationLib.dll, and use the functions in the "ItemTrackingOperations" namespace for adding, and editing work items within the Vault Professional Projects.

Re: How do I start?

Posted: Fri Dec 15, 2017 12:14 pm
by dbaltz
It's not recognizing "MantisLib". I must still be missing a reference.

using VaultClientIntegrationLib;
using VaultClientOperationsLib;
using VaultClientNetLib;
using ItemTrackingOperations;
using MantisLib;

I am referencing:
VaultClientOperationsLib
VaultClientIntegrationLib
VaultClientNetLib
VaultLib

Re: How do I start?

Posted: Fri Dec 15, 2017 12:19 pm
by dbaltz
DragnetLib! Found it.

Re: How do I start?

Posted: Fri Dec 15, 2017 1:57 pm
by jclausius
Sorry, I had forgotten about that too... Dragnet was the name before Fortress before Vault Professional! Too much historical stuff in here. Happy you were able to uncover it.

Re: How do I start?

Posted: Fri Dec 15, 2017 5:58 pm
by dbaltz
On Validate() I get:
"Object reference not set to an instance of an object."

To what Object is it referring?

Re: How do I start?

Posted: Mon Dec 18, 2017 10:18 am
by jclausius
Do you have a little more information? A call stack, file or line number?

Re: How do I start?

Posted: Mon Dec 18, 2017 11:09 am
by dbaltz
This is the exception stack it throws:

StackTrace " at VaultClientIntegrationLib.ItemTrackingOperations.ProcessCommandListFortressProjects()\r\n at VaultClientIntegrationLib.FortressItemExpanded.SetProject(String project)\r\n at VaultClientIntegrationLib.FortressItemExpanded.Validate()\r\n at ExcelToVault.Form1.button1_Click(Object sender, EventArgs e) in c:\\Bladewerx\\Buglist\\ExcelToVault\\Form1.cs:line 154" string

Code: Select all

                Migrate.Enabled = false;
                objsht = (Excel.Worksheet)wbexcel.Worksheets.get_Item(ApplicationsList.SelectedIndex+1);
                item.ProjectName = objsht.Name;
                i = 1;
                ProcessText.Text = "Processing:         ";
                string value = objsht.Cells[i, 1].Value.ToString();
                try
                {
                    while (value != "")
                    {
                        try
                        {
                            if (Convert.ToInt16(value) > 0)
                            {
                                DefectID = Convert.ToInt16(value);
                                ProcessText.Text = "Processing: " + value;
                                ProcessText.Update();
                                Description = objsht.Cells[i, 2].Value.ToString();
                                ReportedIn = objsht.Cells[i, 3].Value.ToString();
                                Resolution = objsht.Cells[i, 4].Value.ToString();
                                FixedIn = objsht.Cells[i, 5].Value.ToString();


                                item.Custom1 = DefectID.ToString();
                                item.Description = Description;
                                item.Details = "(None)";
                                item.ItemType = "Bug";
                                item.VersionStr = FixedIn;
                                item.Priority = PriorityVal.Medium.ToString();
                                item.TimeEstimate = "Unknown";
                                item.DueDate = "15-Dec-2020";
                                item.Assignee = "dB";
                                item.Milestone = "(None)";
                                item.Platform = "Windows";
                                item.Category = "(None)";
                                item.Custom2 = ReportedIn;
                                item.throwExceptions = true;
                                if (Resolution == "Fixed")
                                    item.Status = StatusVal.Completed.ToString();
                                else if (Resolution == "Cancelled")
                                    item.Status = StatusVal.Disregard.ToString();
                                else if (Resolution == "CNR")
                                    item.Status = StatusVal.Unconfirmed.ToString();
                                else if (Resolution == "")
                                    item.Status = StatusVal.Open.ToString();
                                else
                                {
                                    item.Status = StatusVal.Invalid.ToString();
                                    item.Details = Resolution;
                                }

                                try
                                {
                                    item.Validate();    /*  Fails here */
                                    MantisItem mi = item.GetMantisItem();
                                    MantisItem addedMi = ItemTrackingOperations.ProcessCommandAddFortressItem(mi);
                                    addedMi.StatusID = mi.StatusID;
                                    addedMi.ItemAccessType = MantisLib.AccessType.Private; // or Public
                                    ItemTrackingOperations.ProcessCommandModifyFortressItem(addedMi);
                                    //ItemTrackingOperations.ProcessCommandAddFortressItem(item);
                                }
                                catch (Exception ex)
                                {
                                    MessageBox.Show(ex.Message);
                                }
                            }
                        }
                        catch { }

                        i++;
                        value = objsht.Cells[i, 1].Value.ToString();
                    }
                }
                catch { }

Re: How do I start?

Posted: Mon Dec 18, 2017 11:34 am
by jclausius
If you try the following does this cause an exception at this new line of code or still at Validate()?


// Try this first :
item.ProjectName = objsht.Name;
item.SetProject(objsht.Name);

---------------------

// Try this second :
// item.SetProject(objsht.Name);

Does either way work?

Re: How do I start?

Posted: Mon Dec 18, 2017 1:44 pm
by dbaltz
It wont compile:
error CS1061: 'VaultClientIntegrationLib.FortressItemExpanded' does not contain a definition for 'SetProject' and no extension method 'SetProject' accepting a first argument of type

Re: How do I start?

Posted: Mon Dec 18, 2017 2:06 pm
by jclausius
OK. Scratch that. The access modifier is private. That's not going to work.

I looked at the code...

ProcessCommandListFortressProjects() assumes you're logged into the Vault Pro server. The client API has logged in to your Vault Pro server, correct?