IVSSItem.Parent Property 

Gets a reference of the IVSSItem type to an object that represents a parent of a file or a project.

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

Syntax

'Declaration
ReadOnly Property Parent As VSSItem
'Usage
Dim instance As IVSSItem
Dim value As VSSItem

value = instance.Parent
VSSItem Parent { get; }
property VSSItem^ Parent {
    VSSItem^ get ();
}
/** @property */
VSSItem get_Parent ()
function get Parent () : VSSItem

Property Value

A reference of the IVSSItem type to an object that represents a parent of a file or a project.

Remarks

[IDL]

HRESULT Parent ([out,retval]IVSSItem **ppIParent);

The parent of a file or a project is the project in which it resides. For example, the Parent property of $/MyProject/MyFile.txt is $/MyProject. If you attempt to reference the parent of the root project, an empty string is returned.

Example

The following example demonstrates how to use the Parent property to display the parent of a file and a project.

[C#]

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

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

        // Open a VSS database using automatic login for security.
        vssDatabase.Open(@"C:\VSSTestDB\srcsafe.ini", 
                         Environment.UserName, ""); 

        // Get IVSSItem references to the project and the file objects.
        IVSSItem vssFolder = 
                 vssDatabase.get_VSSItem("$/TestFolder", false);
        IVSSItem vssFile = 
                 vssDatabase.get_VSSItem("$/TestFolder/test.txt", false);
     
        Console.WriteLine("The parent of '{0}' project is '{1}'", 
                          vssFolder.Spec, vssFolder.Parent.Spec);
        Console.WriteLine("The parent of '{0}' file is '{1}' project", 
                          vssFile.Spec, vssFile.Parent.Spec);
    }
}

Output:

The parent of '$/TestFolder' project is '$/'

The parent of '$/TestFolder/test.txt' file is '$/TestFolder' project

See Also

Reference

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