IVSSItem.Links Property 

Gets a reference of the IVSSItems type to an object that represents a collection of projects that share common files or projects.

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

Syntax

'Declaration
ReadOnly Property Links As IVSSItems
'Usage
Dim instance As IVSSItem
Dim value As IVSSItems

value = instance.Links
IVSSItems Links { get; }
property IVSSItems^ Links {
    IVSSItems^ get ();
}
/** @property */
IVSSItems get_Links ()
function get Links () : IVSSItems

Property Value

A reference of the IVSSItems type to an object that represents a collection of projects that share common files or projects.

Remarks

[IDL]

HRESULT Links([out, retval] IVSSItems **ppIItems);

When files or folders are shared, changes to these files or folders are reflected in all projects that share them. Every file and folder has at least one link - to itself.

Example

The following example demonstrates how to use the Links property to retrieve the links of a specific file.

To run this example:

  • Create two folders $/A and $/B.

    The $/A folder must contain a file named a.txt.

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

        // Get IVSSItem references to the project and the file objects. 
        IVSSItem vssFolder = vssDatabase.get_VSSItem("$/B", false);
        VSSItem vssFile1 = vssDatabase.get_VSSItem("$/A/a.txt", false);

        DisplayLinks(vssFile1);
        // Share a file between two folders.
        vssFolder.Share(vssFile1, "Comment for share", 0);
        DisplayLinks(vssFile1);

        IVSSItem vssFile2 = vssDatabase.get_VSSItem("$/B/a.txt", false);
        // Break the shared link between folders $/A and $/B on file a.txt.
        vssFile2.Branch("Branch comment", 0);
        DisplayLinks(vssFile1);

        // Destroy file a.txt in folder $/B:
        vssFile2.Destroy();
    }

    private static void DisplayLinks(IVSSItem vssFile)
    { 
        Console.Write("\n{0} contains links:", vssFile.Spec);
        foreach(IVSSItem vssItem in vssFile.Links)
            Console.Write("  {0}", vssItem.Spec);
    }
}

Output:

$/A/a.txt contains links: $/A/a.txt

$/A/a.txt contains links: $/B/a.txt $/A/a.txt

$/A/a.txt contains links: $/A/a.txt

See Also

Reference

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