GetBestWorkingFolder and Get latest file

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

Moderator: SourceGear

random
Posts: 16
Joined: Tue Apr 29, 2008 11:53 am
Location: Longueuil, Québec
Contact:

Post by random » Wed Apr 30, 2008 11:57 am

both fullPaths and diskPaths contain 0 items.

shannon

Post by shannon » Wed Apr 30, 2008 11:59 am

Somehow you aren't connecting to the gui client and within your code as the same user. Working folders are stored per user and per machine.

random
Posts: 16
Joined: Tue Apr 29, 2008 11:53 am
Location: Longueuil, Québec
Contact:

Post by random » Wed Apr 30, 2008 12:04 pm

How would I go about determining if this is the case? I do not think that I am connecting to my client but rather the server, which probably explains why I am not getting a working folder. This is the code that I use to login, where path is the path to our vault server. I believe I am using the same credentials, but I will double check.

public static bool Login( string path, string repository, string username, string password )
{
if( m_isConnected )
return true;

try
{
m_client = new ClientInstance();
m_client.Init(VaultClientNetLib.VaultConnection.AccessLevelType.Client );

if( !string.IsNullOrEmpty( path ) )
m_path = path;

if( !string.IsNullOrEmpty( repository ) )
m_repository = repository;

if( string.IsNullOrEmpty( username ) || string.IsNullOrEmpty( password ) )
throw new ArgumentNullException( "username or password is null or empty" );

m_client.Login( m_path, username, password );

// set the active repository
VaultLib.VaultRepositoryInfo[] repositories = null;
m_client.ListRepositories( ref repositories );

foreach( VaultLib.VaultRepositoryInfo repositoryInfo in repositories )
{
if( repositoryInfo.RepName.ToUpper() == m_repository.ToUpper() )
{
m_client.SetActiveRepositoryID( repositoryInfo.RepID, username, repositoryInfo.RepName, true, false );
break;
}
}

m_path = path;
m_repository = repository;
m_isConnected = true;
return true;
}
catch
{
}

return false;

random
Posts: 16
Joined: Tue Apr 29, 2008 11:53 am
Location: Longueuil, Québec
Contact:

Post by random » Wed Apr 30, 2008 12:14 pm

I have confirmed that I am using the same username and password in both the GUI client and API calls.

shannon

Post by shannon » Wed Apr 30, 2008 12:23 pm

try setting the working folder from your code before listing the working folder assignments.

random
Posts: 16
Joined: Tue Apr 29, 2008 11:53 am
Location: Longueuil, Québec
Contact:

Post by random » Wed Apr 30, 2008 1:19 pm

Setting the working folder through code does work; however, I was hoping that I could use the working folders defined in Vault GUI client.

Is there a possible workaround?

shannon

Post by shannon » Wed Apr 30, 2008 2:49 pm

Compare the value of ClientInstance.LocalStoreBasePath with the value the gui client is using for the cache location (Options->Local Files->Cache Location). If your app is running as a different windows user, these paths will be different.

random
Posts: 16
Joined: Tue Apr 29, 2008 11:53 am
Location: Longueuil, Québec
Contact:

Post by random » Thu May 01, 2008 8:19 am

The paths are the same.

shannon

Post by shannon » Thu May 01, 2008 8:47 am

Is the code for this app running on a different machine than the gui client you are using?

random
Posts: 16
Joined: Tue Apr 29, 2008 11:53 am
Location: Longueuil, Québec
Contact:

Post by random » Thu May 01, 2008 8:48 am

Both the GUI client and the application that uses the API are running on the same machine.

shannon

Post by shannon » Thu May 01, 2008 10:04 am

Can you give me a screenshot of the Cache location page of the options dialog from your gui client please?

random
Posts: 16
Joined: Tue Apr 29, 2008 11:53 am
Location: Longueuil, Québec
Contact:

Post by random » Thu May 01, 2008 10:26 am

From the API call:

m_client.LocalStoreBasePath
"D:\\Program Files\\SourceGear\\Vault_1\\Client"

GUI Client options

Image

shannon

Post by shannon » Thu May 01, 2008 2:02 pm

I don't think I can figure this out without more detailed information about your application and setup. Please email support at sourcegear.com ATTN: shannon with a link to this thread and your phone number.

random
Posts: 16
Joined: Tue Apr 29, 2008 11:53 am
Location: Longueuil, Québec
Contact:

Post by random » Fri May 02, 2008 6:52 am

I have sent you an email with a repro application. Thank you for assistance, it is greatly appreciated.

Post Reply