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

SharePoint 2013

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)

public void SaveBinary(
	Stream file,
	bool checkRequiredFields,
	bool createVersion,
	string etagMatch,
	string lockIdMatch,
	Stream fileFormatMetaInfo,
	bool requireWebFilePermissions,
	out string etagNew
)

Parameters

file
Type: System.IO.Stream

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

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.

Show: