Expand Minimize

StorageFolder.GetFileAsync | getFileAsync method

Applies to Windows and Windows Phone

Gets the file with the specified name from the current folder.

Syntax


Public Function GetFileAsync(
  name As String 
) As IAsyncOperation(Of StorageFile)

Parameters

name

Type: String [JavaScript] | System.String [.NET] | Platform::String [C++]

The name (or path relative to the current folder) of the file to get.

Return value

Type: IAsyncOperation<StorageFile>

When this method completes successfully, it returns a StorageFile that represents the specified file.

Exceptions

ExceptionCondition
System.IO.FileNotFoundException

The specified file does not exist. Check the value of name.

System.UnauthorizedAccessException

You don't have permission to access the specified file.

System.ArgumentException

The path cannot be in Uri format (for example, /image.jpg). Check the value of name.

Remarks

To get an item that's a file or a folder, call the GetItemAsync method.

Examples

The following example shows how to get a file from the current folder by calling the GetFileAsync method. This example also shows how to get a file from a subfolder of the current folder by providing a relative path.

No code example is currently available or this language may not be supported.

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8

Namespace

Windows.Storage
Windows::Storage [C++]

Metadata

Windows.winmd

See also

StorageFolder
GetItemAsync

 

 

Show:
© 2014 Microsoft