Share via


StorageFile.GetFileFromPathAsync(String) 方法

定义

获取 一个 StorageFile 对象,该对象表示指定路径上的文件。

public:
 static IAsyncOperation<StorageFile ^> ^ GetFileFromPathAsync(Platform::String ^ path);
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<StorageFile> GetFileFromPathAsync(winrt::hstring const& path);
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<StorageFile> GetFileFromPathAsync(string path);
function getFileFromPathAsync(path)
Public Shared Function GetFileFromPathAsync (path As String) As IAsyncOperation(Of StorageFile)

参数

path
String

Platform::String

winrt::hstring

要获取要表示的 StorageFile 的文件的路径。

如果路径使用斜杠,请确保使用反斜杠 (\) 。 此方法不接受 /) (正斜杠。

返回

此方法完成后,它将文件作为 StorageFile 返回。

属性

例外

指定的文件不存在。 检查 path 的值。

你没有访问指定文件的权限。 有关详细信息,请参阅 文件访问权限

路径不能是相对路径或 URI。 检查 path 的值。

适用于

另请参阅