Share via


DocumentBase.CheckIn(Boolean, Object, Boolean) Method

Definition

Puts a document on a server from a local computer, and sets the local document to read-only so that it cannot be edited locally.

public void CheckIn (bool saveChanges, ref object comments, bool makePublic);
member this.CheckIn : bool * obj * bool -> unit
Public Sub CheckIn (Optional saveChanges As Boolean, Optional ByRef comments As Object, Optional makePublic As Boolean)

Parameters

saveChanges
Boolean

true to save the document to the server location. The default is true.

comments
Object

Comments for the revision of the document being checked in (only applies if SaveChanges is set to true).

makePublic
Boolean

true to allow the user to publish the document after it is checked in.

Examples

The following code example uses the CanCheckin method to determine whether the document has been stored on a Microsoft SharePoint Portal Server. If the document has been stored on a server, then the example calls the CheckIn method to check in the document, save changes to the server location, and submit the document for the approval process. To use this example, run it from the ThisDocument class in a document-level project.

private void DocumentCheckIn()
{
    if (this.CanCheckin())
    {
        object comments = "My updates.";
        this.CheckIn(true, ref comments, true);
    }
    else
    {
        MessageBox.Show("This document cannot be checked in");
    }
}
Private Sub DocumentCheckIn()
    If CanCheckin() = True Then
        Me.CheckIn(True, "My updates.", True)
    Else
        MessageBox.Show("This document cannot be checked in")
    End If
End Sub

Remarks

Setting the makePublic parameter to true submits the document for the approval process, which can eventually result in a version of the document being published to users with read-only rights to the document (only applies if saveChanges is set to true).

To take advantage of the collaboration features built into Word, documents must be stored on a Microsoft SharePoint Portal Server.

Optional Parameters

For information on optional parameters, see Optional Parameters in Office Solutions.

Applies to