Share via


IVSSItem.Items Property 

Gets a reference of the IVSSItems type to an object that represents a collection of all children (files and projects) of a project.

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

Syntax

'Declaration
ReadOnly Property Items ( _
    <InAttribute> <OptionalAttribute> Optional IncludeDeleted As Boolean = False _
) As IVSSItems
'Usage
Dim instance As IVSSItem
Dim IncludeDeleted As Boolean
Dim value As IVSSItems

value = instance.Items(IncludeDeleted)
IVSSItems Items [
    [OptionalAttribute] [InAttribute] bool IncludeDeleted
] { get; }
property IVSSItems^ Items [bool] {
    IVSSItems^ get ([InAttribute] [OptionalAttribute] bool IncludeDeleted);
}
/** @property */
IVSSItems get_Items (/** @attribute InAttribute() */ /** @attribute OptionalAttribute() */ boolean IncludeDeleted)
JScript supports the use of indexed properties, but not the declaration of new ones.

Parameters

Property Value

A reference of the IVSSItems type to an object that represents a collection of all children (files and projects) of a project.

Remarks

[IDL]

HRESULT Items ([in,defaultvalue(0)]boolean IncludeDeleted, [out,retval]IVSSItems **ppIItems);

Each SourceSafe project may contain up to four types of objects:

  • deleted files

  • non-deleted files

  • deleted projects

  • non-deleted projects.

Only immediate children of a project are returned. This property does not work recursively.

Example

The following example demonstrates how to use the Items property to display all non-deleted items in a project.

To run this example:

  • Create a $/TestFolder/ project.

    The $/TestFolder/ contains: file1.txt, file2.txt, Subfolder1, Subfolder2.

[C#]

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

public class IVSSTest
{
    public static void Main()
    {
        string testFolder = "$/TestFolder";
        
        // 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, ""); 

        // Get an IVSSItem reference to the project object.
        IVSSItem vssFolder = vssDatabase.get_VSSItem(testFolder, false);

        // Display folder contents.
        Console.Write("{0} contains:", vssFolder.Spec);
        foreach(IVSSItem vssItem in vssFolder.get_Items(false))
            Console.Write(" {0}", vssItem.Name);
    }
}

Output:

$/TestFolder contains: file1.txt file2.txt Subfolder1 Subfolder2

[Visual Basic]

Imports System
Imports Microsoft.VisualStudio.SourceSafe.Interop

Module IVSSTest

    Public Sub Main()

        Dim testFolder As String = "$/TestFolder"

        ' Create a VSSDatabase object.
        Dim vssDatabase As IVSSDatabase = New VSSDatabase

        ' Open a VSS database using network name for automatic user login.
        vssDatabase.Open("C:\VSSTestDB\srcsafe.ini", Environment.UserName, "")

        ' Get an IVSSItem reference to the project object.
        Dim vssFolder As IVSSItem = vssDatabase.VSSItem(testFolder, False)

        ' Display project contents.
        Console.Write("{0} contains:", vssFolder.Spec)
        Dim vssItem As IVSSItem
        For Each vssItem In vssFolder.Items(False)
            Console.Write(" {0}", vssItem.Name)
        Next vssItem

    End Sub

End Module

Output:

$/TestFolder contains: file1.txt file2.txt Subfolder1 Subfolder2

See Also

Reference

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