0

It's my first time I develop a .NET winforms application using Vault Client API functionalities. I want to use Vault Client API to get a list of the labels per project.

I found the method ServerOperations.ProcessCommandFindLabels() in VaultClientIntegrationLib.dll but I don't have any clue how the parameters should look like to get a successful result.

Any help is appreciated.

Daniel Mann
  • 57,011
  • 13
  • 100
  • 120
Tassisto
  • 9,877
  • 28
  • 100
  • 157

1 Answers1

1

After many attempts I can get all labels of a project by running the code below.

I added two dll's (VaultLib.dll and VaultClientIntegrationLib.dll) under the References in Visual Studio Project and added 2 using statements (in the class)

using VaultLib;
using VaultClientIntegrationLib;

I've added the following code in a static method

ServerOperations.client.LoginOptions.URL = url;
ServerOperations.client.LoginOptions.User = user;
ServerOperations.client.LoginOptions.Password = pass;
ServerOperations.client.LoginOptions.Repository = rep;
ServerOperations.Login();
ServerOperations.client.AutoCommit = true;

string prjPath = "$/projectpath";
VaultLabelItemX[] arLabelItems = null;

int nRetCode = ServerOperations.ProcessCommandFindLabels("*", prjPath, false, 1000, true, true, VaultFindInFilesDefine.PatternMatch.Wildcard, out arLabelItems);

MessageBox.Show(arLabelItems.Count().ToString()); // Print how much labels found

foreach (var item in arLabelItems)
{
   MessageBox.Show(arLabelItems[i].Label.ToString()); // Show Label 
}
Tassisto
  • 9,877
  • 28
  • 100
  • 157