Vault API History of Labels but without Inherited Labels?

If you are having a problem using Vault, post a message here.

Moderator: SourceGear

Post Reply
peterbrown05
Posts: 41
Joined: Fri Oct 10, 2008 2:09 am

Vault API History of Labels but without Inherited Labels?

Post by peterbrown05 » Thu May 20, 2010 7:59 am

Is it possible to get back a list of labels in vault for a specific folder/repository using the API but for it NOT to return inherited labels (ie, to return the list of labels as if the tick box on the client ui had been deselected)???

we currently do the following;

Code: Select all

VaultLib.VaultHistoryQueryRequest req = new VaultLib.VaultHistoryQueryRequest();
               
            ArrayList actions = new ArrayList();
            req.SubstringType = VaultLib.VaultQueryRequestSubstrings.FileFolderNames;                      
            req.IsFolder = true;
            req.Recursive = true;   
            req.RepID = ServerOperations.client.ClientInstance.ActiveRepositoryID;
            req.TopName = strRepositoryPath;
            req.Type = VaultHistoryType.Label;
            req.Sorts = new long[1];
            req.Sorts[0] = (long)VaultQueryRequestSort.DateSort | VaultQueryRequestSort.DescSort;
      
            actions.Clear();

            //If user didn't specify beginning and end date
                req.DateFilterMask = VaultQueryRequestDates.HistoryAfter;
                req.BeginDate = req.EndDate = VaultDate.EmptyDate();
            
           
	string token = String.Empty;
	int rowsRetrieved = 0;
VaultLib.VaultHistoryItem[] items = new VaultLib.VaultHistoryItem[1];

            ServerOperations.client.ClientInstance.Connection.HistoryBegin(req, 1000, ref rowsRetrieved, ref token);

problem is though that pulling back 1000 records is time consuming, but equally upping that makes it worse. We know that for a particular module we have probably only labeled it a handful of times - but everyone of our automated builds puts in a label at the top level which is displayed as an inherited label....

SO, getting results back that are not inherited would be great.

please advise,
cheers
peteB

jclausius
Posts: 3706
Joined: Tue Dec 16, 2003 1:17 pm
Location: SourceGear
Contact:

Re: Vault API History of Labels but without Inherited Labels?

Post by jclausius » Thu May 20, 2010 12:20 pm

peteB,

You're using a history request. While that will retrieve labels applied to specific objects, you have asked a question specifically regarding labels.

The client API to strictly work with labels as in the GUI client is found in ClientInstance::BeginLabelQuery(), ClientInstance::GetLabelQueryItems_Main() and ClientInstance::EndLabelQuery().

The 4th param of BeginLableQuery controls whether inherited labels are retrieved.
Jeff Clausius
SourceGear

Post Reply