Vault API fails on ProcessComandListFolder

Post your questions regarding using the Vault and Fortress API in your programs.

Moderator: SourceGear

Post Reply
CGauntS
Posts: 2
Joined: Mon Jul 06, 2015 12:57 am

Vault API fails on ProcessComandListFolder

Post by CGauntS » Mon Jul 06, 2015 1:10 am

Hello. I am using Vault 7.1.0, with the appropriate version of the API. I have been building an application that compares different versions of files and generate a simple report based on the comments between releases. I have been able to successfully create a simple GUI for it, and have the system login, as well as get the repository list, but I have been unable to get a list of folders within the test repository.

I tried to use

Code: Select all

        string RootFolder = "$/";
        VaultClientFolderColl folders = ServerOperations.ProcessCommandListFolder (RootFolder, true).Folders;
to no avail, as all I get is a NullReferenceException within Vault's API itself (VaultClientIntegrationLib.dll). I am confused about why it is not working. Is this supposed to be done some other way?

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

Re: Vault API fails on ProcessComandListFolder

Post by jclausius » Tue Jul 07, 2015 1:39 pm

In your login, is a valid repository name provided to the Login Options? Another thing you can check is after the Login has completed, ServerOperations.client.ClientInstance should be valid, and also that should have another member: ServerOperations.client.ClientInstance.Repository. Is that value null or is it instantiated?

If not, the Repository name may be invalid or you may need to call SetRepository().
Jeff Clausius
SourceGear

mskrobul
Posts: 490
Joined: Wed Jan 14, 2004 10:22 am
Location: SourceGear
Contact:

Re: Vault API fails on ProcessComandListFolder

Post by mskrobul » Tue Jul 07, 2015 1:44 pm

It is hard to say what is going on without looking at the rest of your code, but I just wrote this little test and ProcessCommandListFolder did work without any exceptions for this simple case:

Code: Select all

			ServerOperations.SetLoginOptions("http://localhost/VaultService", "admin", "admin", "Initial Repository", false);
			ServerOperations.Login();

			string RootFolder = "$/";
			VaultClientFolderColl folders = ServerOperations.ProcessCommandListFolder (RootFolder, true).Folders;

The VaultClientIntegrationLib Source code is included with the API download. You can load the actual VaultClientIntegrationLibAPI.csproj into your solution, reference and debug it if necessary.
Mary Jo Skrobul
SourceGear

CGauntS
Posts: 2
Joined: Mon Jul 06, 2015 12:57 am

Re: Vault API fails on ProcessComandListFolder

Post by CGauntS » Wed Jul 08, 2015 1:15 am

It appears the issue was indeed the repository. Upon closer inspection, the string I was passing in was wrong... Not it seems to be working fine. Thank you for the help.

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

Re: Vault API fails on ProcessComandListFolder

Post by jclausius » Wed Jul 08, 2015 8:20 am

Glad you figured it out. Thanks for the update.
Jeff Clausius
SourceGear

Post Reply