Share via


DocumentBase.CheckInWithVersion Method

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.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Syntax

'Declaration
Public Sub CheckInWithVersion ( _
    saveChanges As Boolean, _
    ByRef comments As Object, _
    makePublic As Boolean, _
    ByRef versionType As Object _
)
public void CheckInWithVersion(
    bool saveChanges,
    ref Object comments,
    bool makePublic,
    ref Object versionType
)

Parameters

  • saveChanges
    Type: System.Boolean
    true to save the document to the server location. The default is true.
  • comments
    Type: System.Object%
    Comments for the revision of the document being checked in (only applies if SaveChanges is set to true).
  • makePublic
    Type: System.Boolean
    true to allow the user to publish the document after it is checked in.
  • versionType
    Type: System.Object%
    Specifies versioning information for the document.

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.

Examples

The following code example uses the CanCheckin method to determine whether the document has been stored on a Microsoft Office SharePoint Portal Server. If the document has been stored on a server, then the example calls the CheckInWithVersion method to check in the document along with the specified comments and version number, 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 Sub DocumentCheckIn()
    If Me.CanCheckin() Then
        Dim comments As Object = "My updates."
        Dim version As Object = _
            Word.WdCheckInVersionType.wdCheckInMinorVersion
        Me.CheckInWithVersion(True, comments, True, version)
    Else
        MessageBox.Show("This document cannot be checked in")
    End If
End Sub
private void DocumentCheckIn()
{
    if (this.CanCheckin())
    {
        object comments = "My updates.";
        object version = Word.WdCheckInVersionType.wdCheckInMinorVersion;
        this.CheckInWithVersion(true, ref comments, true, ref version);                
    }
    else
    {
        MessageBox.Show("This document cannot be checked in");
    }
}

.NET Framework Security

See Also

Reference

DocumentBase Class

Microsoft.Office.Tools.Word Namespace