Expand Minimize

StorageFolder.GetFolderFromPathAsync | getFolderFromPathAsync method

Applies to Windows and Windows Phone

Gets the StorageFolder 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 file system path (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 requested 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 StorageFolder that has the specified absolute path in the file system by calling the GetFolderFromPathAsync method.


using Windows.Storage;
using System.Threading.Tasks;
...
            // Get the path to the app's Assets folder.
            string root = Windows.ApplicationModel.Package.Current.InstalledLocation.Path;
            string path = root + @"\Assets";

            // Get the folder object that corresponds to this file system path.
            StorageFolder folder = await StorageFolder.GetFolderFromPathAsync(path);


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

 

 

Show:
© 2014 Microsoft