Partager via


SaveButton.SaveItem method (SPContext, Boolean, String)

Saves a list item and checks it in and uploads it when the list is a document library.

Namespace:  Microsoft.SharePoint.WebControls
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
Public Shared Function SaveItem ( _
    itemContext As SPContext, _
    uploadMode As Boolean, _
    checkInComment As String _
) As Boolean
'Usage
Dim itemContext As SPContext
Dim uploadMode As Boolean
Dim checkInComment As String
Dim returnValue As Boolean

returnValue = SaveButton.SaveItem(itemContext, _
    uploadMode, checkInComment)
public static bool SaveItem(
    SPContext itemContext,
    bool uploadMode,
    string checkInComment
)

Parameters

  • uploadMode
    Type: System.Boolean

    true to indicate that the list item is a document that is being uploaded; otherwise, false.

  • checkInComment
    Type: System.String

    The text of a descriptive comment for the item.

Return value

Type: System.Boolean
true in all cases.

Exceptions

Exception Condition
ArgumentNullException

itemContext or checkInComment is a null reference (Nothing in Visual Basic).

InvalidOperationException

itemContext.Item is a null reference (Nothing in Visual Basic).

Remarks

SaveItem always returns true if the method is completed without throwing an exception.

See also

Reference

SaveButton class

SaveButton members

SaveItem overload

Microsoft.SharePoint.WebControls namespace