Share via


IVSSDatabase.VSSItem Property 

Gets a reference of the IVSSItem type to an object representing a SourceSafe file or a SourceSafe project.

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

Syntax

'Declaration
ReadOnly Property VSSItem ( _
    <InAttribute> Spec As String, _
    <InAttribute> <OptionalAttribute> Optional Deleted As Boolean = False _
) As VSSItem
'Usage
Dim instance As IVSSDatabase
Dim Spec As String
Dim Deleted As Boolean
Dim value As VSSItem

value = instance.VSSItem(Spec, Deleted)
VSSItem VSSItem [
    [InAttribute] string Spec,
    [OptionalAttribute] [InAttribute] bool Deleted
] { get; }
property VSSItem^ VSSItem [String^, bool] {
    VSSItem^ get ([InAttribute] String^ Spec, [InAttribute] [OptionalAttribute] bool Deleted);
}
/** @property */
VSSItem get_VSSItem (/** @attribute InAttribute() */ String Spec, /** @attribute InAttribute() */ /** @attribute OptionalAttribute() */ boolean Deleted)
JScript supports the use of indexed properties, but not the declaration of new ones.

Parameters

  • Spec
    A complete SourceSafe path of the IVSSItem such as "$/" or $/MyProject/MyFile.txt."

Property Value

A reference of the IVSSItem type to an object representing a SourceSafe file or a SourceSafe project.

Remarks

[IDL]

HRESULT VSSItem ([in]BSTR Spec, [in,defaultvalue(0)]boolean bDeleted, (out,retval)IVSSItem **ppIVSSItem);

Example

The following example demonstrates how to use the VSSItem property to display the name of the project.

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

        // vssFolder represents a SourceSafe project "TestFolder".
        IVSSItem vssFolder = vssDatabase.get_VSSItem("$/TestFolder", false);

        //Display project's name
        Console.WriteLine("SourceSafe project's name is '" + 
                          vssFolder.Name + "'.");
    }
}

Output:

SourceSafe project's name is 'TestFolder'.

Imports System
Imports Microsoft.VisualStudio.SourceSafe.Interop

Module IVSSTest
     
        Public Sub Main()
            ' Create a VSSDatabase object.
            Dim vssDatabase As New VSSDatabase

            ' Open VSS database.
            vssDatabase.Open("C:\VSSTestDB\srcsafe.ini", _
                             Environment.UserName, "")
            ' vssFolder represents a SourceSafe project "TestFolder".
            Dim vssFolder As IVSSItem = _
                             vssDatabase.VSSItem("$/TestFolder", False)

            ' Display project's name
             Console.WriteLine("SourceSafe project's name is '" + _
                               vssFolder.Name + "'.")

        End Sub 'Main

End Module

Output:

SourceSafe project's name is 'TestFolder'.

See Also

Reference

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