PickFolderResult Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents the result of a folder picking operation. This is a lightweight class that contains a string attribute representing the folder path.
public ref class PickFolderResult sealed
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.Windows.Storage.Pickers.StoragePickersContract, 65544)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class PickFolderResult final
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.Windows.Storage.Pickers.StoragePickersContract), 65544)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class PickFolderResult
Public NotInheritable Class PickFolderResult
- Inheritance
- Attributes
Examples
The following example demonstrates how to use the PickFolderResult class to get the folder path of a selected folder:
using Microsoft.Windows.Storage.Pickers;
var picker = new FolderPicker();
var result = await picker.PickFolderAsync();
if (result != null)
{
// Perform this conversion if you have business logic that uses StorageFolder
var storageFolder = await Windows.Storage.StorageFolder.GetFolderFromPathAsync(result.Path)
// Continue your business logic with storageFolder
}
else
{
// Add error handling logic here
}
#include <winrt/Microsoft.Windows.Storage.Pickers.h>
using namespace winrt::Microsoft::Windows::Storage::Pickers;
FolderPicker picker;
auto& result{ co_await openPicker.PickSingleFolderAsync() };
if (result)
{
// Perform this conversion if you have business logic that uses StorageFolder
auto& storageFolder{ co_await winrt::Windows::Storage::StorageFolder::GetFolderFromPathAsync(result.Path) }
// Continue your business logic with storageFolder
}
else
{
// Add error handling logic here
}
Remarks
A PickFolderResult object can be converted to a Windows.Storage.StorageFolder object by calling Windows.Storage.StorageFolder.GetFolderFromPathAsync with the folder Path.
Properties
| Path |
The path of the folder selected by the user in a folder picker operation. This is a string representation of the folder's location in the file system. |