Page 1 of 1

How to retrieve a list of labels for an object?

Posted: Thu Jan 29, 2009 5:04 pm
by joacim
I was wondering how I would go about to get a list of the labels assigned to a Vault folder? I'm really just interested in the labels directly assigned to the folder, not any inherited labels. I've done some investigation and I assume I need to use the BeginLabelQuery(), the GetLabelQueryItem_Main(), and the EndLabelQuery() methods however I'm not clear on the parameter lists of these methods. Any examples would be highly appreciated.

Re: How to retrieve a list of labels for an object?

Posted: Thu Jan 29, 2009 6:53 pm
by shannon
I think this code snippet should cover it, but let me know if something is still unclear. If you called GetLabelQueryItems_Recursive, you'd pass rowsRetRecur instead of rowsRetMain.

Code: Select all

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, // max rows to return
    out rowsRetMain,
    out rowsRetRecur,
    out qryToken);
VaultLabelItemX[] labelItems;
// start at 0 and go to the end (rowsRetMain)
ServerOperations.client.ClientInstance.GetLabelQueryItems_Main(
    qryToken, 0, (int) rowsRetMain, out labelItems);

Re: How to retrieve a list of labels for an object?

Posted: Fri Jan 30, 2009 7:17 am
by joacim
Thank you it works perfectly. Don't I have to call the EndLabelQuery() method?

Re: How to retrieve a list of labels for an object?

Posted: Fri Jan 30, 2009 8:45 am
by shannon
Sorry, yes you should.

Re: How to retrieve a list of labels for an object?

Posted: Mon Feb 02, 2009 5:49 am
by joacim
Is there a limit on the number of labels an object can have in Vault?

Re: How to retrieve a list of labels for an object?

Posted: Thu Mar 12, 2009 2:17 pm
by joacim
joacim wrote:Is there a limit on the number of labels an object can have in Vault?
Still wondering... :)

Re: How to retrieve a list of labels for an object?

Posted: Mon Mar 16, 2009 7:57 am
by lbauer
There's no specific limit, but labels will add to the size of your database, so make sure you have adequate disk space.