Checkin Method Example

The program in this example performs the following steps:

Note   To run this example, you must have a source control project in place on a web with a file called "C:\My Documents\My Webs\Rogue Cellars\Zinfandel.htm" (for a server running on Microsoft Windows) or "C:\WINNT\Profiles\logon alias\Personal\My Webs\Rogue Cellars\Zinfandel.htm" (for a server running on Windows NT). Or, you may substitute a web and file of your choice.

Private Sub CheckinFile()
Dim myWeb As Web
Dim myFile As WebFile
Dim myPageWindow As PageWindow
Dim myWelcome As String

Set myWeb = Webs("C:/My Webs/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