Share via


IVSSDatabase.User Property 

Gets a reference of the IVSSUser type to an object representing a single user.

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

Syntax

'Declaration
ReadOnly Property User ( _
    <InAttribute> Name As String _
) As VSSUser
'Usage
Dim instance As IVSSDatabase
Dim Name As String
Dim value As VSSUser

value = instance.User(Name)
VSSUser User [
    [InAttribute] string Name
] { get; }
property VSSUser^ User [String^] {
    VSSUser^ get ([InAttribute] String^ Name);
}
/** @property */
VSSUser get_User (/** @attribute InAttribute() */ String Name)
JScript supports the use of indexed properties, but not the declaration of new ones.

Parameters

Property Value

A reference of the IVSSUser type to an object representing a single user.

Remarks

[IDL]

HRESULT User([in] BSTR Name, [out, retval] IVSSUser **ppIUser);

Every SourceSafe database can have one or more users and each user is represented by an object that implements the IVSSUser interface.

Example

The following example demonstrates how to use the User property to retrieve a specific user.

[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, ""); 
    
        // User property returns VSSUser type reference. 
        VSSUser vssUser = vssDatabase.get_User("Guest");
     
        // Display user name
        Console.WriteLine("User Name: " + vssUser.Name);
    }
}

Output:

User Name: Guest

[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, "")

        ' User property returns VSSUser type reference
        Dim vssUser As VSSUser = vssDatabase.User("Guest")

        'Display user name
        Console.WriteLine("User Name: " + vssUser.Name)

    End Sub

End Module

Output:

User Name: Guest

See Also

Reference

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