Hello,
Can you provide some advice on how to enumerate a list of labels after a ServerOperations connection has been made? I would like to obtain the same list of labels possible in the existing client to enumerate over them.
UD
Enumerating labels
Moderator: SourceGear
This can be done, but it's a bit tricky. Here's some pseudo-code for how to loop over the labels.
Please be patient, as I haven't put much time into the pseudo-code. Thank you for pointing this out, because we should definitely put something like this in ServerOperations for the future.
Code: Select all
int numRowsInherited;
int numRowsRecursive;
string token = String.Empty;
VaultClientNetLib.ClientService.VaultLabelItemX[] items = null;
int foundID = -1;
VaultClientTreeObject obj = RepositoryUtil.FindVaultTreeObjectAtReposOrLocalPath("$/path");
ServerOperations.Client.ClientInstance.BeginLabelQuery(obj.FullPath, obj.ID, false, false, true, false, 1000, out numRowsInherited, out numRowsRecursive, out token);
if (token == null || token == String.Empty)
return some error status;
ServerOperations.Client.ClientInstance.GetLabelQueryItems_Main(token, 0, numRowsInherited, out items);
if (items == null)
return some error status;
foreach (VaultLabelItemX item in items)
{
//Here's your loop.
}
ServerOperations.Client.ClientInstance.EndLabelQuery(token);