Windows Dev Center

Expand Minimize

StorageFolder.GetFolderFromPathAsync | getFolderFromPathAsync method

Gets the folder that has the specified absolute path in the file system.

Syntax


public:
static IAsyncOperation<StorageFolder>^ GetFolderFromPathAsync(
  String^ path
)

Parameters

path

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

The absolute path in the file system (not the Uri) of the folder to get.

Return value

Type: IAsyncOperation<StorageFolder>

When this method completes successfully, it returns a StorageFolder that represents the specified folder.

Exceptions

ExceptionCondition
System.IO.FileNotFoundException

The specified folder does not exist. Check the value of path.

System.UnauthorizedAccessException

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

System.ArgumentException

The path cannot be a relative path or a Uri. Check the value of path.

Examples

The following example shows how to get the folder that has the specified absolute path in the file system by calling the GetFolderFromPathAsync method.


	// Get the path to the app's Assets folder.
	String^ root = Windows::ApplicationModel::Package::Current->InstalledLocation->Path;

	// Get the folder object that corresponds to
	// this absolute path in the file system.
	create_task(StorageFolder::GetFolderFromPathAsync(root)).then([=](StorageFolder^ folder){
		String^ output = folder->Name;
		OutputDebugString(output->Begin());
	});


Requirements (device family)

Device family

Universal

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

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

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (operating system)

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

 

 

Show:
© 2015 Microsoft