Share via


IVSSCheckout.Machine Property 

Gets a string containing the machine name from which the file checkout occurred.

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

Syntax

'Declaration
ReadOnly Property Machine As String
'Usage
Dim instance As IVSSCheckout
Dim value As String

value = instance.Machine
string Machine { get; }
property String^ Machine {
    String^ get ();
}
/** @property */
String get_Machine ()
function get Machine () : String

Property Value

A string containing the machine name from which the file checkout occurred.

Remarks

[IDL]

HRESULT Machine ([out,retval]BSTR *pMachine);

Example

The following example demonstrates how to iterate through the IVSSCheckouts collection of a file and display the Machine property for each checkout.

To perform this test, the file $/A/a.txt must be checked out by two users. Multiple checkouts must be enabled by the VSS Administrator. To enable multiple checkouts, on the Tools menu, click Options, click the General tab, select the Allow Multiple Checkouts check box, and click OK.

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, ""); 
            
        IVSSItem vssFile = vssDatabase.get_VSSItem("$/A/a.txt", false);

        foreach(IVSSCheckout vssCheckout in vssFile.Checkouts)
        {
            Console.WriteLine("Checked out to :  {0}", vssCheckout.Username);
            Console.WriteLine("Comment        :  {0}", vssCheckout.Comment);
            Console.WriteLine("Date           :  {0}", vssCheckout.Date);
            Console.WriteLine("LocalSpec      :  {0}", vssCheckout.LocalSpec);
            Console.WriteLine("Machine        :  {0}", vssCheckout.Machine);
            Console.WriteLine("Project        :  {0}", vssCheckout.Project);
            Console.WriteLine("VersionNumber  :  {0}", vssCheckout.VersionNumber);
            Console.WriteLine();
        }    
        Console.WriteLine("Number of Checkouts: " + vssFile.Checkouts.Count);
        Console.WriteLine("\n");
    }
}

Output:

Checked out to : Guest

Comment : Check out to working folder

Date : 11/10/2003 10:52:40 AM

LocalSpec : C:\VSSTESTWF\A

Machine : Tester_01

Project : $/A

VersionNumber : 1

Checked out to : Admin

Comment : Check out to folder C:\1

Date : 11/10/2003 10:51:56 AM

LocalSpec : C:\1

Machine : Tester_02

Project : $/A

VersionNumber : 1

Number of checkouts: 2

See Also

Reference

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