FileRandomAccessStream.OpenForUserAsync Method

Definition

Overloads

OpenForUserAsync(User, String, FileAccessMode, StorageOpenOptions, FileOpenDisposition)

Opens a stream for a user to a file given a file path and the user's information. If the file does not exist, it can be created using FileOpenDisposition.

OpenForUserAsync(User, String, FileAccessMode)

Opens a stream for a user to an existing file given the file path and the user's information.

OpenForUserAsync(User, String, FileAccessMode, StorageOpenOptions, FileOpenDisposition)

Opens a stream for a user to a file given a file path and the user's information. If the file does not exist, it can be created using FileOpenDisposition.

public:
 static IAsyncOperation<IRandomAccessStream ^> ^ OpenForUserAsync(User ^ user, Platform::String ^ filePath, FileAccessMode accessMode, StorageOpenOptions sharingOptions, FileOpenDisposition openDisposition);
/// [Windows.Foundation.Metadata.Overload("OpenForUserWithOptionsAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<IRandomAccessStream> OpenForUserAsync(User const& user, winrt::hstring const& filePath, FileAccessMode const& accessMode, StorageOpenOptions const& sharingOptions, FileOpenDisposition const& openDisposition);
[Windows.Foundation.Metadata.Overload("OpenForUserWithOptionsAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<IRandomAccessStream> OpenForUserAsync(User user, string filePath, FileAccessMode accessMode, StorageOpenOptions sharingOptions, FileOpenDisposition openDisposition);
function openForUserAsync(user, filePath, accessMode, sharingOptions, openDisposition)
Public Shared Function OpenForUserAsync (user As User, filePath As String, accessMode As FileAccessMode, sharingOptions As StorageOpenOptions, openDisposition As FileOpenDisposition) As IAsyncOperation(Of IRandomAccessStream)

Parameters

user
User

The user account for opening the stream.

filePath
String

Platform::String

winrt::hstring

A path to the file to be opened.

accessMode
FileAccessMode

The permissions level to open the stream with.

sharingOptions
StorageOpenOptions

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

openDisposition
FileOpenDisposition

An action to take on the file.

Returns

A stream to the specified file.

Attributes

Windows requirements

Device family
Windows 10 Fall Creators Update (introduced in 10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v5.0)

Applies to

OpenForUserAsync(User, String, FileAccessMode)

Opens a stream for a user to an existing file given the file path and the user's information.

public:
 static IAsyncOperation<IRandomAccessStream ^> ^ OpenForUserAsync(User ^ user, Platform::String ^ filePath, FileAccessMode accessMode);
/// [Windows.Foundation.Metadata.Overload("OpenForUserAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<IRandomAccessStream> OpenForUserAsync(User const& user, winrt::hstring const& filePath, FileAccessMode const& accessMode);
[Windows.Foundation.Metadata.Overload("OpenForUserAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<IRandomAccessStream> OpenForUserAsync(User user, string filePath, FileAccessMode accessMode);
function openForUserAsync(user, filePath, accessMode)
Public Shared Function OpenForUserAsync (user As User, filePath As String, accessMode As FileAccessMode) As IAsyncOperation(Of IRandomAccessStream)

Parameters

user
User

The user account for opening the stream.

filePath
String

Platform::String

winrt::hstring

A path to the file to be opened.

accessMode
FileAccessMode

The permissions level to open the stream with.

Returns

A stream to the specified file.

Attributes

Windows requirements

Device family
Windows 10 Fall Creators Update (introduced in 10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v5.0)

Applies to