GetByLabel_GetData API sample

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

Moderator: SourceGear

Post Reply
michaelF
Posts: 6
Joined: Thu Apr 27, 2006 8:56 am

GetByLabel_GetData API sample

Post by michaelF » Thu May 11, 2006 5:48 am

It is possible to have a sample on how to use the GetByLabel_GetData API function.

With the source vault version 3.1.8 I get an exception saying "Value cannot be null. Parameter name : path".

Here is the code I call :

public bool GetFolderByLabel(string remoteFolderPath, string localFolderPath, string label, bool recursive)
{
...
long labelID = 0;
long rootID = 0;
long labelSubItemId = 0;
string[] discoveredPaths;
VaultClientTreeObject labelStructure = null;
VaultClientTreeObject reposTreeObj = m_client.TreeCache.Repository.Root.FindTreeObjectRecursive(remoteFolderPath);
if (reposTreeObj == null)
{
//MessageBox.Show("Folder " + remoteFolderPath + " does not exist.");
return false;
}
labelSubItemId = reposTreeObj.ID;
if (!m_client.GetByLabel_GetStructure(remoteFolderPath, label, ref labelID, String.Empty, out discoveredPaths, out labelStructure, out rootID))
{
//MessageBox.Show("Cannot find label " + label + ".");
return false;
}
string labelSubItem = discoveredPaths[0];
VaultGetResponse[] responses = m_client.GetByLabel_GetData((VaultClientFolder) labelStructure, recursive, MakeWritableType.MakeAllFilesReadOnly, SetFileTimeType.Current, MergeType.OverwriteWorkingCopy, null, labelID, remoteFolderPath, labelSubItem);
...
}
Last edited by michaelF on Thu May 11, 2006 9:33 am, edited 1 time in total.

dan
Posts: 2448
Joined: Wed Dec 17, 2003 5:03 pm
Location: SourceGear
Contact:

Post by dan » Thu May 11, 2006 7:41 am

The command line client source code has an example of these calls in the ProcessCommandGetLabel() command in VaultCmdLineClient.cs. The CLC source is included with the API installer.

So, I would suggest looking there first for usuage, and you might even want to run the CLC in the debugger to see exactly what is passed into it.

michaelF
Posts: 6
Joined: Thu Apr 27, 2006 8:56 am

Post by michaelF » Thu May 11, 2006 9:35 am

Thank you very much for your answer.
The provided VaultCmdLineClient.cs sample is very useful and now I am able to make the GetByLabel_GetData function work.

Post Reply