SPFile.SaveBinary Method (Stream, Boolean, Boolean, String, String, Stream, String)

Saves the file and file format metadata based on the specified streams, strings, and optional ETag value.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
Available in SharePoint Online

Syntax

'Declaration
<SubsetCallableExcludeMemberAttribute(SubsetCallableExcludeMemberType.MarshalByRefObject)> _
Public Sub SaveBinary ( _
    file As Stream, _
    checkRequiredFields As Boolean, _
    createVersion As Boolean, _
    etagMatch As String, _
    lockIdMatch As String, _
    fileFormatMetaInfo As Stream, _
    <OutAttribute> ByRef etagNew As String _
)
'Usage
Dim instance As SPFile
Dim file As Stream
Dim checkRequiredFields As Boolean
Dim createVersion As Boolean
Dim etagMatch As String
Dim lockIdMatch As String
Dim fileFormatMetaInfo As Stream
Dim etagNew As String

instance.SaveBinary(file, checkRequiredFields, _
    createVersion, etagMatch, lockIdMatch, _
    fileFormatMetaInfo, etagNew)
[SubsetCallableExcludeMemberAttribute(SubsetCallableExcludeMemberType.MarshalByRefObject)]
public void SaveBinary(
    Stream file,
    bool checkRequiredFields,
    bool createVersion,
    string etagMatch,
    string lockIdMatch,
    Stream fileFormatMetaInfo,
    out string etagNew
)

Parameters

  • checkRequiredFields
    Type: System.Boolean

    A Boolean value that specifies whether required fields should be checked before saving the file.

    true to check required fields when saving the file; otherwise, false.

  • createVersion
    Type: System.Boolean

    A Boolean value that specifies that a new version is created when the file is saved. This can only occur when versioning is enabled and valid for this document. true to force the creating of a new version of the file when saved; otherwise, false. Note that setting this parameter false will cause the default behavior to take place.

  • etagMatch
    Type: System.String

    If not a null reference (Nothing in Visual Basic), then the file will only be saved if this string matches the current SPFile.ETag of the file.

  • lockIdMatch
    Type: System.String

    If not a null reference (Nothing in Visual Basic) and there is a lock on the file, then the file save will succeed only if the value matches the current SPFile.LockId. For a shared lock, this value must be specified for the same to succeed. For more information about shared lock, see the SPFile.SPLockTypeenumeration.

  • fileFormatMetaInfo
    Type: System.IO.Stream

    A System.IO.Stream object that contains the file format metadata.

  • etagNew
    Type: System.String

    When this method returns, contains a String that is the ETag value of the newly opened file. This parameter is passed uninitialized.

See Also

Reference

SPFile Class

SPFile Members

SaveBinary Overload

Microsoft.SharePoint Namespace