IVSSItem.Checkin Method 

Checks in a checked-out file or project to the SourceSafe database.

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

Syntax

'Declaration
Sub Checkin ( _
    <InAttribute> <OptionalAttribute> Optional Comment As String = "", _
    <InAttribute> <OptionalAttribute> Optional Local As String = "", _
    <InAttribute> <OptionalAttribute> Optional iFlags As Integer = 0 _
)
'Usage
Dim instance As IVSSItem
Dim Comment As String
Dim Local As String
Dim iFlags As Integer

instance.Checkin(Comment, Local, iFlags)
void Checkin (
    [OptionalAttribute] [InAttribute] string Comment,
    [OptionalAttribute] [InAttribute] string Local,
    [OptionalAttribute] [InAttribute] int iFlags
)
void Checkin (
    [InAttribute] [OptionalAttribute] String^ Comment, 
    [InAttribute] [OptionalAttribute] String^ Local, 
    [InAttribute] [OptionalAttribute] int iFlags
)
void Checkin (
    /** @attribute InAttribute() */ /** @attribute OptionalAttribute() */ String Comment, 
    /** @attribute InAttribute() */ /** @attribute OptionalAttribute() */ String Local, 
    /** @attribute InAttribute() */ /** @attribute OptionalAttribute() */ int iFlags
)
function Checkin (
    Comment : String, 
    Local : String, 
    iFlags : int
)

Parameters

  • Comment
    Optional. A string containing a comment. The default is an empty string.
  • Local
    Optional. A string representing a fully qualified local path from which a file or a project is checked in. The default value, null, represents a folder to which the file or the project was checked out.
  • iFlags
    Optional. The default value is 0. For more information, see VSSFlags.

Remarks

[IDL]

HRESULT Checkin ([in,defaultvalue(0)]BSTR Comment, [in,defaultvalue(0)]BSTR Local, [in,defaultvalue(0)] long iFlags);

Example

The following example demonstrates how to use the Checkin method to check in a file to the SourceSafe database. In this example, the file, test.txt, is checked out, modified, and checked in.

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

public class IVSSTest
{
    public static void Main()
    {
        string testFile = "$/TestFolder/test.txt";
        
        // 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(testFile, false);

        vssFile.Checkout("Checkout comment", @"C:\1\test.txt", 0); 

        if((VSSFileStatus)vssFile.IsCheckedOut == 
           VSSFileStatus.VSSFILE_NOTCHECKEDOUT)
            Console.WriteLine(vssFile.Spec + " is checked in.");
        else
            Console.WriteLine(vssFile.Spec + " is checked out.");

        Console.WriteLine("Now alter the file and hit any key.");
        Console.ReadLine();

        vssFile.Checkin("Checkin comment", @"C:/1/test.txt", 0);

        if((VSSFileStatus)vssFile.IsCheckedOut == 
           VSSFileStatus.VSSFILE_NOTCHECKEDOUT)
            Console.WriteLine(vssFile.Spec + " is checked in.");
        else
            Console.WriteLine(vssFile.Spec + " is checked out.");
    }
}

// Output:

//$/TestFolder/test.txt is checked out.

//Now alter the file and hit any key.

//

//$/TestFolder/test.txt is checked in.

See Also

Reference

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