FileRandomAccessStream.OpenForUserAsync 方法

定义

重载

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

在给定文件路径和用户信息的情况下,为用户打开文件流。 如果该文件不存在,可以使用 FileOpenDisposition 创建它。

OpenForUserAsync(User, String, FileAccessMode)

在给定文件路径和用户信息的情况下,为用户打开到现有文件的流。

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

在给定文件路径和用户信息的情况下,为用户打开文件流。 如果该文件不存在,可以使用 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)

参数

user
User

用于打开流的用户帐户。

filePath
String

Platform::String

winrt::hstring

要打开的文件的路径。

accessMode
FileAccessMode

用于打开流的权限级别。

sharingOptions
StorageOpenOptions

枚举值的按位组合,指定用于打开流的选项。

openDisposition
FileOpenDisposition

要对文件执行的操作。

返回

流式传输到指定文件。

属性

Windows 要求

设备系列
Windows 10 Fall Creators Update (在 10.0.16299.0 中引入)
API contract
Windows.Foundation.UniversalApiContract (在 v5.0 中引入)

适用于

OpenForUserAsync(User, String, FileAccessMode)

在给定文件路径和用户信息的情况下,为用户打开到现有文件的流。

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)

参数

user
User

用于打开流的用户帐户。

filePath
String

Platform::String

winrt::hstring

要打开的文件的路径。

accessMode
FileAccessMode

用于打开流的权限级别。

返回

流式传输到指定文件。

属性

Windows 要求

设备系列
Windows 10 Fall Creators Update (在 10.0.16299.0 中引入)
API contract
Windows.Foundation.UniversalApiContract (在 v5.0 中引入)

适用于