经过多次尝试,我可以通过运行下面的代码来获取项目的所有标签。
我添加了两个using语句(在课堂上)
using VaultLib;
using VaultClientIntegrationLib;
我已经添加下面的代码在DLL中的(VaultLib.dll和VaultClientIntegrationLib.dll)在Visual Studio项目引用下,并添加2静态方法
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
}