Checks the specified WebFile object out to the source control project.
Note You must have a source control project in place before using this method. For information about source control projects, refer to Managing Source Control Projects.
expression.Checkout(ForceCheckout)
expression An expression that returns a WebFile object.
ForceCheckout Optional Boolean. Forces a checkout, even if the file is already checked out. True forces a checkout of the file. Default value is False.
Remarks
The ForceCheckout argument provides the administrator with the ability to force a checkout in cases where a file has been checked out by a user who is unavailable to check the file back in.
Example
The program in this example performs the following:
- Checks out a file from an existing source control project and puts the file in edit mode.
- Adds a welcome message to the document.
- Checks if the open page has been modified.
- Saves the page, if it has been modified.
- Closes the file and checks it into the existing source control project.
Note To run this example, you must have a source control project in place on a Web site with a file called "C:\My Documents\My Web Sites\Rogue Cellars\Zinfandel.htm". Or, you may substitute an alternative Web site and file name.
Private Sub CheckoutFile()
Dim myWeb As WebEx
Dim myFile As WebFile
Dim myPageWindow As PageWindowEx
Dim myWelcome As String
Set myWeb = Webs("C:/My Web Sites/Rogue Cellars")
myWelcome = "Welcome to my Web Site!"
Set myFile = myWeb.RootFolder.Files("Zinfandel.htm")
myFile.Checkout
Set myPageWindow = myFile.Edit(fpPageViewNormal)
With myPageWindow
myPageWindow.Document.body.insertAdjacentText("BeforeEnd", _
myWelcome)
If myPageWindow.IsDirty = True Then myPageWindow.Save
.Close
End With
myFile.Checkin
End Sub