IVSSDatabase.Open Method 

Logs a user into the Visual SourceSafe database.

Namespace: Microsoft.VisualStudio.SourceSafe.Interop
Assembly: Microsoft.VisualStudio.SourceSafe.Interop (in microsoft.visualstudio.sourcesafe.interop.dll)

Syntax

'Declaration
Sub Open ( _
    <InAttribute> <OptionalAttribute> Optional SrcSafeIni As String = "", _
    <InAttribute> <OptionalAttribute> Optional Username As String = "", _
    <InAttribute> <OptionalAttribute> Optional Password As String = "" _
)
'Usage
Dim instance As IVSSDatabase
Dim SrcSafeIni As String
Dim Username As String
Dim Password As String

instance.Open(SrcSafeIni, Username, Password)
void Open (
    [OptionalAttribute] [InAttribute] string SrcSafeIni,
    [OptionalAttribute] [InAttribute] string Username,
    [OptionalAttribute] [InAttribute] string Password
)
void Open (
    [InAttribute] [OptionalAttribute] String^ SrcSafeIni, 
    [InAttribute] [OptionalAttribute] String^ Username, 
    [InAttribute] [OptionalAttribute] String^ Password
)
void Open (
    /** @attribute InAttribute() */ /** @attribute OptionalAttribute() */ String SrcSafeIni, 
    /** @attribute InAttribute() */ /** @attribute OptionalAttribute() */ String Username, 
    /** @attribute InAttribute() */ /** @attribute OptionalAttribute() */ String Password
)
function Open (
    SrcSafeIni : String, 
    Username : String, 
    Password : String
)

Parameters

  • SrcSafeIni
    A fully qualified path, including a file name, to the srcsafe.ini file of the current SourceSafe database.
  • Username
    A name of the Visual SourceSafe user attempting to log in to the SourceSafe database. The default is the name of the user logged in to the Windows session.
  • Password
    A password of the Visual SourceSafe user attempting to log in to the SourceSafe database. The default is an empty string.

Remarks

[IDL]

HRESULT Open ([in,defaultvalue(0)]BSTR SrcSafeIni, [in,defaultvalue(0)]BSTR Username, [in,defaultvalue(0)]BSTR Password);

You are allowed to open multiple databases simultaneously. However, a specific database object may reference only one database at the time.

If an invalid path is passed, a run-time error is generated. When this parameter is omitted, SourceSafe looks for the SRCSAFE.INI in the following order:

  1. Directory where SSAPI.DLL is located.

  2. Directory path to SSAPI.DLL. For example, if SSAPI.DLL is located in C:\Folder1\Folder2\Folder3\SSAPI.DLL, Folder3, Folder2, Folder1 and C:\ are searched (in this order).

  3. Location indicated by the named value "SCCProviderPath" or " SCCServerPath" in the registry key HKEY_LOCAL_MACHINE\Software\Microsoft\SourceSafe.

If you specify invalid Username or Password, a run-time error is generated. If a user does not have a password, an empty string is specified.

Example

The following example demonstrates how to use Open method to log in to the Visual SourceSafe database.

[C#]

using System;
using Microsoft.VisualStudio.SourceSafe.Interop;

public class IVSSTest
{
    public static void Main()
    {
        // Create a VSSDatabase object.
        IVSSDatabase vssDatabase = new VSSDatabase();

        // Open a VSS database using network name 
        // for automatic user login.
        vssDatabase.Open(@"C:\VSSTestDB\srcsafe.ini", 
                         Environment.UserName, 
                         ""); 
        // Display user's current project. 
        Console.WriteLine("The {0}'s current project is '{1}'", 
                          vssDatabase.Username, vssDatabase.CurrentProject);
    }
}

Output:

The Guest's current project is '$/MyProject'

See Also

Reference

IVSSDatabase Interface
IVSSDatabase Members
Microsoft.VisualStudio.SourceSafe.Interop Namespace