Share via


IVSSCheckouts.Count Property 

Gets the number of times that the file has been checked out.

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

Syntax

'Declaration
ReadOnly Property Count As Integer
'Usage
Dim instance As IVSSCheckouts
Dim value As Integer

value = instance.Count
int Count { get; }
property int Count {
    int get ();
}
/** @property */
int get_Count ()
function get Count () : int

Property Value

The number of times that the file has been checked out.

Remarks

[IDL]

HRESULT Count ([out,retval]long *piCount);

Example

The following example demonstrates how to iterate through the IVSSCheckouts collection of a file and display the number of the file checkouts.

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

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