共用方式為


SPFile.SaveBinary Method (Byte , Boolean)

Saves the file in binary format based on the specified byte array and a Boolean value that specifies whether to check required fields.

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

Syntax

'Declaration
Public Sub SaveBinary ( _
    file As Byte(), _
    checkRequiredFields As Boolean _
)
'Usage
Dim instance As SPFile
Dim file As Byte()
Dim checkRequiredFields As Boolean

instance.SaveBinary(file, checkRequiredFields)
public void SaveBinary(
    byte[] file,
    bool checkRequiredFields
)

Parameters

  • file
    Type: []

    A byte array that contains the file.

  • checkRequiredFields
    Type: System.Boolean

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

Exceptions

Exception Condition
SPException

An error occurred while saving the file.

Remarks

This method calls SaveBinary(Stream, Boolean, Boolean, String, String, Stream, String) with new MemoryStream(file), checkRequiredFields, false, null , null , null , and an unused string.

See Also

Reference

SPFile Class

SPFile Members

SaveBinary Overload

Microsoft.SharePoint Namespace