OpenBinary Method

The OpenBinary method of the SPFile class opens the file in binary format.

Return Value

A byte array that contains the file version.

Remarks

The OpenBinary method fails if the size of the file is 0 (zero) bytes.

Example

The following code example iterates through the collection of files in the Shared Documents document library of the current site and opens each file in binary format so that it can be attached to a specified item in the Events list.

This example requires using directives (Imports in Visual Basic) for both the Microsoft.SharePoint and Microsoft.SharePoint.WebControls namespaces.

Requirements

Platforms: Microsoft Windows ServerĀ 2003

Security: Code Access Security