Compartilhar via


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

Saves the file and file format metadata based on the specified streams, strings, Boolean value, 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.PerSpec)> _
Public Sub SaveBinary ( _
    file As Stream, _
    checkRequiredFields As Boolean, _
    createVersion As Boolean, _
    etagMatch As String, _
    lockIdMatch As String, _
    fileFormatMetaInfo As Stream, _
    requireWebFilePermissions As Boolean, _
    <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 requireWebFilePermissions As Boolean
Dim etagNew As String

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

Parameters

  • checkRequiredFields
    Type: System.Boolean

    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.

  • requireWebFilePermissions
    Type: System.Boolean

    A Boolean value that indicates if updating Web files requires the Add and Customize Web Pages permission. The default is true.

  • etagNew
    Type: System.String

    When this method returns, contains a [System.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