IVSSItem.Checkout MethodÂ
Checks out a file or project from the SourceSafe database.
Namespace: Microsoft.VisualStudio.SourceSafe.Interop
Assembly: Microsoft.VisualStudio.SourceSafe.Interop (in microsoft.visualstudio.sourcesafe.interop.dll)
Syntax
'Declaration
Sub Checkout ( _
<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.Checkout(Comment, Local, iFlags)
void Checkout (
[OptionalAttribute] [InAttribute] string Comment,
[OptionalAttribute] [InAttribute] string Local,
[OptionalAttribute] [InAttribute] int iFlags
)
void Checkout (
[InAttribute] [OptionalAttribute] String^ Comment,
[InAttribute] [OptionalAttribute] String^ Local,
[InAttribute] [OptionalAttribute] int iFlags
)
void Checkout (
/** @attribute InAttribute() */ /** @attribute OptionalAttribute() */ String Comment,
/** @attribute InAttribute() */ /** @attribute OptionalAttribute() */ String Local,
/** @attribute InAttribute() */ /** @attribute OptionalAttribute() */ int iFlags
)
function Checkout (
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 to which a file or a project is checked out. If you check out a file, the path includes the file name. The default value, null or an empty string, represents the working folder (LocalSpec ) of a file or a project.
- iFlags
Optional. The default value is 0. For more information, see VSSFlags.
Remarks
[IDL]
HRESULT Checkout ([in,defaultvalue(0)]BSTR Comment, [in,defaultvalue(0)]BSTR Local, [in,defaultvalue(0)]long iFlags);
Example
The following example demonstrates how to use the Checkout method to check out a file from 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