Label Query Question
Posted: Tue Apr 15, 2008 5:24 pm
I"m trying to a query for all items with a label of READY_FOR_TEST with the following code:
[TEST 1]
First I test a scenario where that label doesn't exist and it finds a single entry for the one label that I do have CHECKED_IN which is assigned at $
[TEST 2]
Then I choose a single source file entry and apply the READY_FOR_TEST label to it and I run it again and it finds 2 entries. One is the folder level CHECKED_IN label and the other is the single file that I labeled.
[TEST 3]
Then I choose a folder above the single file and assign the READY_FOR_TEST label to that. This time when I run it, I get 2 entries. one is for the folder level READY_FOR_TEST and the other is for the file entry for the same label. What happened to the CHECKED_IN label? I know that I'm not looking for it but it doesn't seem consistent.
[TEST 4]
For one more test, I select several individual files and label them with READY_FOR_TEST and run my code again. This time, I get exactly the same results as TEST 3.
Can you see anything in my code that is just wrong? What I'd like to do is see the same results that I'd see in the desktop client if I right click on "$" and choose "Show Labels" with "Files and Folders" selected "Act recursively" checked. How would I do that in code?
I'd really appreciate help with this one!
Stephen
Code: Select all
ServerOperations.client.LoginOptions.URL = "http://myserver/VaultService";
ServerOperations.client.LoginOptions.User = "admin";
ServerOperations.client.LoginOptions.Password = "password";
ServerOperations.client.LoginOptions.Repository = "Main";
ServerOperations.client.AutoCommit = true;
ServerOperations.client.Verbose = true;
ServerOperations.client.LoginOptions.AccessLevel = VaultConnection.AccessLevelType.Admin;
ServerOperations.Login();
long objId = RepositoryUtil.FindVaultTreeObjectAtReposOrLocalPath("$").ID;
string qryToken;
long rowsRetMain;
long rowsRetRecur;
ServerOperations.client.ClientInstance.BeginLabelQuery(
"$",
objId,
true, // get recursive
true, // get inherited
true, // get file items
true, // get folder items
1000,
out rowsRetMain,
out rowsRetRecur,
out qryToken);
VaultLabelItemX[] labelItems;
ServerOperations.client.ClientInstance.GetLabelQueryItems_Recursive(
qryToken, 0, (int) rowsRetMain, out labelItems);
if (labelItems == null)
return;
foreach(VaultLabelItemX item in labelItems)
{
if (item.Name.Equals("READY_FOR_TEST"))
{
Console.WriteLine(item.CurrentPath);
}
}
First I test a scenario where that label doesn't exist and it finds a single entry for the one label that I do have CHECKED_IN which is assigned at $
[TEST 2]
Then I choose a single source file entry and apply the READY_FOR_TEST label to it and I run it again and it finds 2 entries. One is the folder level CHECKED_IN label and the other is the single file that I labeled.
[TEST 3]
Then I choose a folder above the single file and assign the READY_FOR_TEST label to that. This time when I run it, I get 2 entries. one is for the folder level READY_FOR_TEST and the other is for the file entry for the same label. What happened to the CHECKED_IN label? I know that I'm not looking for it but it doesn't seem consistent.
[TEST 4]
For one more test, I select several individual files and label them with READY_FOR_TEST and run my code again. This time, I get exactly the same results as TEST 3.
Can you see anything in my code that is just wrong? What I'd like to do is see the same results that I'd see in the desktop client if I right click on "$" and choose "Show Labels" with "Files and Folders" selected "Act recursively" checked. How would I do that in code?
I'd really appreciate help with this one!
Stephen