GetBestWorkingFolder and Get latest file
Moderator: SourceGear
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;
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;