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

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

Parameters

file
Type: System.IO.Stream

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

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.

Show: