IVSSDatabase.Username Property
Gets a string representing a name of the user currently logged on to a SourceSafe database.
Namespace: Microsoft.VisualStudio.SourceSafe.Interop
Assembly: Microsoft.VisualStudio.SourceSafe.Interop (in microsoft.visualstudio.sourcesafe.interop.dll)
Syntax
'Declaration
ReadOnly Property Username As String
'Usage
Dim instance As IVSSDatabase
Dim value As String
value = instance.Username
string Username { get; }
property String^ Username {
String^ get ();
}
/** @property */
String get_Username ()
function get Username () : String
Property Value
A string representing a name of the user currently logged on to a SourceSafe database.
Remarks
[IDL]
HRESULT UserName ([out,retval]BSTR *pUsername);
Example
The following example demonstrates how to use the Username property to display the name of the user currently logged on to the 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 name
Console.WriteLine("User Name: " + vssDatabase.Username);
}
}
Output:
User Name: Guest1
[Visual Basic]
Imports System
Imports Microsoft.VisualStudio.SourceSafe.Interop
Module IVSSTest
Public Sub Main()
' Create a VSSDatabase object.
Dim vssDatabase = New VSSDatabase
' Open a VSS database using automatic login for security.
vssDatabase.Open("C:\VSSTestDB\srcsafe.ini", Environment.UserName, "")
'Display user name
Console.WriteLine("User Name: " + vssDatabase.Username)
End Sub
End Module
Output:
User Name: Guest1
See Also
Reference
IVSSDatabase Interface
IVSSDatabase Members
Microsoft.VisualStudio.SourceSafe.Interop Namespace