Share via


IVSSCheckout.VersionNumber Property 

Gets a version number of the checked out file.

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

Syntax

'Declaration
ReadOnly Property VersionNumber As Integer
'Usage
Dim instance As IVSSCheckout
Dim value As Integer

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

Property Value

A version number of the checked out file.

Remarks

[IDL]

HRESULT VersionNumber ([out,retval]long *piVersion);

The version number is incremented each time the new IVSSVersion is added.

Example

The following example demonstrates how to iterate through the IVSSCheckouts collection of a file and display the VersionNumber 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