I am trying to get files from the repository using the C# API. I only want to get files with a certain extension. The version of Vault is 5.1.2.
It's easy to do this with the Command Line Client:
vault getwildcard -user USER -password PW -host HOST -destpath "d:\\PATH" -repository REPO "$/REPO_FOLDER/" *.EXT
After searching the forums, reading the docs and trying some experiments in code I'm still having no luck. Is this or something like it possible? Am I missing something obvious? Any help is appreciated. Thanks.
How to do CLC GetWildCard from the API?
Moderator: SourceGear
Re: How to do CLC GetWildCard from the API?
There's a wildcard array class in the API code.
This specifies a parameter of type String[] which is an array of wildcard strings.
Check the Client API directory for the VaultClientIntegrationLib.chm, which has details.
This specifies a parameter of type String[] which is an array of wildcard strings.
Check the Client API directory for the VaultClientIntegrationLib.chm, which has details.
Linda Bauer
SourceGear
Technical Support Manager
SourceGear
Technical Support Manager
Re: How to do CLC GetWildCard from the API?
Also, this link http://support.sourcegear.com/viewtopic.php?f=31&t=8020 provides some code:
public static void WildcardTasks()
{
string url = "http://VaultServer/VaultService";
string username = "username";
string password = "password";
string repository = "Your Repository";
// Set the login options and login/connect to a repository.
ServerOperations.client.LoginOptions.URL = url;
ServerOperations.client.LoginOptions.User = username;
ServerOperations.client.LoginOptions.Password = password;
ServerOperations.client.LoginOptions.Repository = repository;
ServerOperations.Login();
ServerOperations.client.AutoCommit = true;
// add some files to use with wildcard tasks
string pathToFile1 = "c:/path/to/wildcard1.txt";
string pathToFile2 = "c:/path/to/wildcard2.txt";
string pathToFile3 = "c:/path/to/wildcardWithLetters.txt";
string folderPath = "$/a/folder/";
ServerOperations.ProcessCommandAdd(folderPath, new string[] { pathToFile1, pathToFile2, pathToFile3 });
// get all three wildcards to a nonworking folder
string wildcardStr = "wildcard*.txt";
GetOptions getOptions = new GetOptions();
string nonworkingFolderPath = "c:/path/to/nonworkingFolderForWildcards/";
GetOperations.ProcessCommandGetWildcardToNonWorkingFolder(folderPath, new string[] { wildcardStr }, getOptions, nonworkingFolderPath);
// get wildcard1.txt and wildcard2.txt to a working folder
wildcardStr = "wildcard?.txt";
string workingFolderPath = "c:/path/to/aWorkingFolder/";
GetOperations.ProcessCommandGetWildcard(workingFolderPath, new string[] {wildcardStr}, getOptions);
}
public static void WildcardTasks()
{
string url = "http://VaultServer/VaultService";
string username = "username";
string password = "password";
string repository = "Your Repository";
// Set the login options and login/connect to a repository.
ServerOperations.client.LoginOptions.URL = url;
ServerOperations.client.LoginOptions.User = username;
ServerOperations.client.LoginOptions.Password = password;
ServerOperations.client.LoginOptions.Repository = repository;
ServerOperations.Login();
ServerOperations.client.AutoCommit = true;
// add some files to use with wildcard tasks
string pathToFile1 = "c:/path/to/wildcard1.txt";
string pathToFile2 = "c:/path/to/wildcard2.txt";
string pathToFile3 = "c:/path/to/wildcardWithLetters.txt";
string folderPath = "$/a/folder/";
ServerOperations.ProcessCommandAdd(folderPath, new string[] { pathToFile1, pathToFile2, pathToFile3 });
// get all three wildcards to a nonworking folder
string wildcardStr = "wildcard*.txt";
GetOptions getOptions = new GetOptions();
string nonworkingFolderPath = "c:/path/to/nonworkingFolderForWildcards/";
GetOperations.ProcessCommandGetWildcardToNonWorkingFolder(folderPath, new string[] { wildcardStr }, getOptions, nonworkingFolderPath);
// get wildcard1.txt and wildcard2.txt to a working folder
wildcardStr = "wildcard?.txt";
string workingFolderPath = "c:/path/to/aWorkingFolder/";
GetOperations.ProcessCommandGetWildcard(workingFolderPath, new string[] {wildcardStr}, getOptions);
}
Linda Bauer
SourceGear
Technical Support Manager
SourceGear
Technical Support Manager
Re: How to do CLC GetWildCard from the API?
Thanks Linda!