How to do CLC GetWildCard from the API?

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

Moderator: SourceGear

Post Reply
kagamat
Posts: 7
Joined: Tue Sep 24, 2013 12:14 pm

How to do CLC GetWildCard from the API?

Post by kagamat » Tue Sep 24, 2013 12:33 pm

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.

lbauer
Posts: 9736
Joined: Tue Dec 16, 2003 1:25 pm
Location: SourceGear

Re: How to do CLC GetWildCard from the API?

Post by lbauer » Wed Sep 25, 2013 8:31 am

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.
Linda Bauer
SourceGear
Technical Support Manager

lbauer
Posts: 9736
Joined: Tue Dec 16, 2003 1:25 pm
Location: SourceGear

Re: How to do CLC GetWildCard from the API?

Post by lbauer » Wed Sep 25, 2013 9:37 am

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);
}
Linda Bauer
SourceGear
Technical Support Manager

kagamat
Posts: 7
Joined: Tue Sep 24, 2013 12:14 pm

Re: How to do CLC GetWildCard from the API?

Post by kagamat » Thu Nov 20, 2014 1:17 pm

Thanks Linda!

Post Reply