Click or drag to resize
GDStorageFolderGetFileAsync Method
Gets the specified file from the current folder.

Namespace:  GD
Assembly:  GD (in GD.dll) Version: 255.255.255.255
Syntax
public IAsyncOperation<GDStorageFile> GetFileAsync(
	string name
)

Parameters

name
Type: SystemString
The name (or path relative to the current folder) of the file to retrieve.

Return Value

Type: IAsyncOperationGDStorageFile
When this method completes successfully, it returns a GDStorageFile that represents the file.

Implements

IGDStorageFolderGetFileAsync(String)
Exceptions
ExceptionCondition
Exception(C# equivalent: System.IO.FileNotFoundException) The specified file does not exist. Check the value of name.
AccessDeniedException(C# equivalent: System.UnauthorizedAccessException) Secure storage was remotely wiped.
InvalidArgumentException(C# equivalent: System.ArgumentException) The path contains invalid characters, or the format of the path is incorrect. Check the value of name.
Remarks
To get an item that's a file or a folder, call the GetItemAsync(String) method.
Examples
The following example shows how to get a file from the current folder by calling the GetFileAsync(String) method. This example also shows how to get a file from a subfolder of the current folder by providing a relative path.
using GD;

// Get root folder of GD secure storage
GDStorageFolder rootFolder = GDWindows.Instance.SecureFolder;

// Get file from the current folder
GDStorageFile fooFile = await rootFolder.GetFileAsync("foo.txt");

// Get a file from a subfolder of the current folder by providing a relative path.
GDStorageFile barFile = await rootFolder.GetFileAsync(@"subdir\bar.txt");
See Also