StorageFolder 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
管理資料夾及其內容,並提供其相關資訊。
public ref class StorageFolder sealed : IStorageFolder, IStorageFolder2, IStorageItem2, IStorageItemProperties2, IStorageItemPropertiesWithProvider, IStorageFolderQueryOperations
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
class StorageFolder final : IStorageFolder, IStorageFolder2, IStorageItem2, IStorageItemProperties2, IStorageItemPropertiesWithProvider, IStorageFolderQueryOperations
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
public sealed class StorageFolder : IStorageFolder, IStorageFolder2, IStorageItem2, IStorageItemProperties2, IStorageItemPropertiesWithProvider, IStorageFolderQueryOperations
Public NotInheritable Class StorageFolder
Implements IStorageFolder, IStorageFolder2, IStorageFolderQueryOperations, IStorageItem2, IStorageItemProperties2, IStorageItemPropertiesWithProvider
- 繼承
- 屬性
- 實作
Windows 需求
| 規格需求 | Description |
|---|---|
| 裝置系列 |
Windows 10 (已於 10.0.10240.0 引進)
|
| API contract |
Windows.Foundation.UniversalApiContract (已於 v1.0 引進)
|
| 應用程式功能 |
documentsLibrary
musicLibrary
picturesLibrary
videosLibrary
|
備註
一般而言,您會取得 StorageFolder 物件做為非同步方法呼叫的傳回值。 例如,靜態方法 GetFolderFromPathAsync 會傳回代表指定資料夾的 StorageFolder。
請注意,當您呼叫檔案選擇器讓使用者挑選資料夾時,檔案選擇器會將資料夾傳回為 StorageFolder。
目前沒有 「MoveAsync」 或類似的方法。 移動資料夾的一個簡單實作可能是取得所需的資料夾、將它複製到所需的位置,然後刪除原始檔案夾。
版本歷程記錄
| Windows 版本 | SDK 版本 | 已新增值 |
|---|---|---|
| 1803 | 17134 | TryGetChangeTracker |
| 2004 | 19041 | GetFolderFromPathForUserAsync |
屬性
| 名稱 | Description |
|---|---|
| Attributes |
取得目前資料夾的屬性。 |
| DateCreated |
取得目前資料夾建立的日期和時間。 |
| DisplayName |
取得目前資料夾的使用者易記名稱。 |
| DisplayType |
取得資料夾類型的易記描述;例如, |
| FolderRelativeId |
取得目前資料夾的識別碼。 此識別碼對於包含目前資料夾或檔案群組的查詢結果或 StorageFolder 而言是唯一的,而且可用來區分具有相同名稱的專案。 |
| Name |
取得目前資料夾的名稱。 |
| Path |
如果路徑可用,則取得檔案系統中目前資料夾的完整路徑。 |
| Properties |
取得 物件,這個物件可讓您存取目前資料夾的內容相關屬性。 |
| Provider |
取得 StorageProvider 物件,其中包含儲存目前資料夾之服務的相關資訊。 |