How do I retrieve the current label comment?
Posted: Thu Feb 18, 2010 7:31 am
I need to retrieve the current label comment in my own vault client (like the vault GUI client does with "show labels..."). From wiresharking the GUI client I got this implementation:
In fact this works fine. However, I feel a little uneasy as this is not part of the official API. Is there a documented version that I missed?
Regards, Christoph
Code: Select all
public string GetLabelComment(string item, string label)
{
string objectPath = fixPath(item);
string token;
long n1, n2;
try
{
ServerOperations.client.ClientInstance.BeginLabelQuery(
objectPath,
0,
false,
false,
false,
false,
10,
out n1,
out n2,
out token);
}
catch
{
throw new UsageException(objectPath + ": no such object");
}
VaultLabelItemX[] lis;
ServerOperations.client.ClientInstance.GetLabelQueryItems_Main(token, 0, 1, out lis);
foreach (VaultLabelItemX li in lis)
{
if (li.Label == label)
{
return li.Comment;
}
}
throw new UsageException(label + ": label not found for '" + objectPath + "'");
}
}
Regards, Christoph