Share via


IStorageFile2.OpenTransactedWriteAsync(StorageOpenOptions) Method

Definition

Opens a random-access stream to the file that can be used for transacted-write operations with the specified options.

public:
 IAsyncOperation<StorageStreamTransaction ^> ^ OpenTransactedWriteAsync(StorageOpenOptions options);
/// [Windows.Foundation.Metadata.Overload("OpenTransactedWriteWithOptionsAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncOperation<StorageStreamTransaction> OpenTransactedWriteAsync(StorageOpenOptions const& options);
[Windows.Foundation.Metadata.Overload("OpenTransactedWriteWithOptionsAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncOperation<StorageStreamTransaction> OpenTransactedWriteAsync(StorageOpenOptions options);
function openTransactedWriteAsync(options)
Public Function OpenTransactedWriteAsync (options As StorageOpenOptions) As IAsyncOperation(Of StorageStreamTransaction)

Parameters

options
StorageOpenOptions

A bitwise combination of the enumeration values that specify options for opening the stream.

Returns

When this method completes, it returns a StorageStreamTransaction containing the random-access stream and methods that can be used to complete transactions.

Attributes

Remarks

This method results in a stream that writes to a temporary file, then atomically commits the writes to the actual file by renaming the temporary file onto the actual file. Because of how the stream writing works, a transacted writer cannot coexist with another writer, meaning StorageOpenOptions.AllowReadersAndWriters is not valid for this method and will return E_INVALIDARG if used.

Applies to