Skip to main content
StorageFolder Class

Permite manipular carpetas y su contenido, y proporciona información sobre ellas.

Sintaxis


var storageFolder = Windows.Storage.StorageFolder;

public sealed class StorageFolder : IStorageFolder,
    IStorageItem,
    IStorageFolderQueryOperations,
    IStorageItemProperties,
    IStorageItemProperties2,
    IStorageItem2,
    IStorageFolder2,
    IStorageItemPropertiesWithProvider

Public NotInheritable Class StorageFolder
    Implements IStorageFolder, _
    IStorageItem, _
    IStorageFolderQueryOperations, _
    IStorageItemProperties, _
    IStorageItemProperties2, _
    IStorageItem2, _
    IStorageFolder2, _
    IStorageItemPropertiesWithProvider

public ref class StorageFolder sealed : IStorageFolder,
    IStorageItem,
    IStorageFolderQueryOperations,
    IStorageItemProperties,
    IStorageItemProperties2,
    IStorageItem2,
    IStorageFolder2,
    IStorageItemPropertiesWithProvider

Atributos

[ Version(0x06020000)]

Miembros

StorageFolderClase tiene estos tipos de miembros:

Métodos

The StorageFolder Clase tiene estos métodos. Con C#, Visual Basic y C++, también hereda métodos de Object Clase.

MétodoDescripción
AreQueryOptionsSupported Determines whether the current folder supports the specified QueryOptions.
CreateFileAsync(String) Creates a new file in the folder or file group.
CreateFileAsync(String, CreationCollisionOption) Creates a new file in the current folder, and specifies what to do if a file with the same name already exists in the current folder.
CreateFileQuery() Creates a query result object to filter and enumerate top-level files in the current folder.
CreateFileQuery(CommonFileQuery) Creates a query result object to filter and enumerate all the files in the current folder and its subfolders. Files are filtered and sorted based on the specified CommonFileQuery.
CreateFileQueryWithOptions Creates a query result object to filter and enumerate the files in the current folder and its subfolders. Files are included in the query result and sorted based on the specified QueryOptions.
CreateFolderAsync(String) Creates a new subfolder inside the current folder.
CreateFolderAsync(String, CreationCollisionOption) Creates a new sub-folder inside the current folder, and specifies what to do if a folder with the same name already exists in the current folder.
CreateFolderQuery() Creates a query result object to filter and enumerate top-level sub-folders of the current folder.
CreateFolderQuery(CommonFolderQuery) Creates a query result object to enumerate files in the current folder by grouping them into StorageFolder objects. Files are filtered and grouped based on the specified CommonFolderQuery.
CreateFolderQueryWithOptions Creates a query result object to filter and enumerate files in the current folder by grouping them into sub-folders. Files are included in the query result and grouped into sub-folders based on the specified QueryOptions.
CreateItemQuery Creates a query result object to filter and enumerate top-level items (files and sub-folders) in the current folder.
CreateItemQueryWithOptions Creates a query result object to filter and enumerate top-level items (files and sub-folders) in the current folder. Items are included in the query result and sorted based on the specified QueryOptions.
DeleteAsync() Deletes the current folder or file group.
DeleteAsync(StorageDeleteOption) Deletes the current folder or file group, optionally deleting it permanently.
GetBasicPropertiesAsync Gets the basic properties of the current folder or file group.
GetFileAsync Gets a single file from the current folder using the specified file name.
GetFilesAsync() Gets the top-level files in the current folder.
GetFilesAsync(CommonFileQuery) Gets a list of all files in the current folder and its sub-folders. Files are filtered and sorted based on the specified CommonFileQuery.
GetFilesAsync(CommonFileQuery, UInt32, UInt32) Gets an index-based range of files from the list of all files in the current the current folder and its sub-folders. Files are filtered and sorted based on the specified CommonFileQuery and are included in the range based on the resulting indexes.
GetFolderAsync Gets a single sub-folder from the current folder using the specified folder name.
GetFolderFromPathAsync Gets a StorageFolder that represents the folder at the specified file-system path.
GetFoldersAsync() Gets a list of the top-level sub-folders of the current folder.
GetFoldersAsync(CommonFolderQuery) Gets a list of StorageFolder objects that represent groups of files in the current folder. Files are filtered and grouped based on the specified CommonFolderQuery.
GetFoldersAsync(CommonFolderQuery, UInt32, UInt32) Gets an index-based range of StorageFolder objects that represent groups of files in the current folder. Files are filtered and grouped based on the specified CommonFolderQuery and are included in the range based on the resulting indexes.
GetIndexedStateAsync Gets the indexed state of the current folder.
GetItemAsync Gets a single file or sub-folder from the current folder using the name of the item.
GetItemsAsync() Gets a list of top-level files and sub-folders inside the current folder.
GetItemsAsync(UInt32, UInt32) Gets an index-based range from a list of all the files and sub-folders inside the current folder. Items in the range based on the resulting indexes.
GetParentAsync Gets the parent folder of the current folder.
GetScaledImageAsThumbnailAsync(ThumbnailMode) Gets a scaled image as a thumbnail, determined by the purpose of the thumbnail.
GetScaledImageAsThumbnailAsync(ThumbnailMode, UInt32) Gets a scaled image as a thumbnail, determined by the purpose of the thumbnail and the requested size.
GetScaledImageAsThumbnailAsync(ThumbnailMode, UInt32, ThumbnailOptions) Gets a scaled image as a thumbnail, determined by the purpose of the thumbnail, the requested size, and the specified options
GetThumbnailAsync(ThumbnailMode) Gets an adjusted thumbnail image for the current folder, determined by the specified purpose of the thumbnail.
GetThumbnailAsync(ThumbnailMode, UInt32) Gets an adjusted thumbnail image for the current folder, determined by the specified purpose of the thumbnail and the requested size.
GetThumbnailAsync(ThumbnailMode, UInt32, ThumbnailOptions) Gets an adjusted thumbnail image for the current folder, determined by the specified purpose of the thumbnail, the requested size, and the specified options.
IsCommonFileQuerySupported Indicates whether the current folder supports the specified CommonFileQuery.
IsCommonFolderQuerySupported Indicates whether the current folder supports the specified CommonFolderQuery.
IsEqual Indicates whether the current folder is equal to the specified folder.
IsOfType Indicates whether the current StorageFolder matches the specified StorageItemTypes value.
RenameAsync(String) Renames the current folder.
RenameAsync(String, NameCollisionOption) Renames the current folder and specifies what to do if a folder with the same name already exists.
TryGetItemAsync Try to get a single file or sub-folder from the current folder by using the name of the item.

 

Propiedades

StorageFolderClase tiene estas propiedades.

PropiedadTipo de accesoDescripción

Attributes

Solo lecturaGets the attributes of the current folder.

DateCreated

Solo lecturaGets the date and time that the current folder was created.

DisplayName

Solo lecturaGets the user-friendly name of the current folder.

DisplayType

Solo lecturaGets the user-friendly type of the folder or file group.

FolderRelativeId

Solo lecturaGets an identifier for the current folder. This ID is unique for the query result or StorageFolder that contains the current folder or file group, and can be used to distinguish between items that have the same name.

Name

Solo lecturaGets the name of the current folder.

Path

Solo lecturaGets the full file-system path of the current folder, if the folder has a path.

Properties

Solo lecturaGets an object that provides access to the content-related properties of the current folder.

Provider

Solo lecturaGets the StorageProvider object that contains info about the service that stores the current folder.

 

Observaciones

Normalmente, se tiene acceso a los objetos StorageFolder como resultado del método asincrónico o de llamadas de función. Por ejemplo, el método estático GetFolderFromPathAsync devuelve un objeto StorageFolder que representa la carpeta especificada.

Además, siempre que se llama a un selector de archivos para permitir al usuario elegir una carpeta el selector de archivos devolverá la carpeta como StorageFolder.

Ejemplos

En este ejemplo se muestra cómo llamar a un selector de archivos mediante FolderPicker.PickSingleFolderAsync para capturar y procesar un archivo que el usuario escoge.


StorageFile folder = await folderPicker.PickSingleFolderAsync();
// Process picked folder
if (folder != null)
{
    // Store folder for future access
    folderToken = Windows.Storage.AccessCache.StorageApplicationPermissions.FutureAccessList.Add(folder);
}
else
{
    // The user didn't pick a folder
}

folderPicker.pickSingleFolderAsync().then(function (folder) {
   if (folder) {
       // Process picked folder

       // Store folder for future access
       var folderToken = Windows.Storage.AccessCache.StorageApplicationPermissions.futureAccessList.add(folder);
   } else {
       // The user didn't pick a folder
   }
});

Después de que PickSingleFileAsync se complete, folder obtiene el archivo seleccionado como StorageFolder.

En el ejemplo, folderPicker contiene un objeto FolderPicker. Para obtener más información sobre cómo usar los selectores de archivos, vea FolderPicker e Inicio rápido: obtener acceso a archivos con selectores de archivos.

Además, folderToken obtiene un identificador que puede utilizar para recuperar la carpeta de FutureAccessList. Para obtener más información sobre el almacenamiento de archivos y carpetas para que se pueda tener acceso a ellos más tarde, vea FutureAccessList, MostRecentlyUsedList y Cómo hacer un seguimiento de los archivos y carpetas usados recientemente.

Requisitos

Cliente mínimo compatible

Windows 8 [Solo aplicaciones de la Tienda Windows]

Servidor mínimo compatible

Windows Server 2012 [Solo aplicaciones de la Tienda Windows]

Teléfono mínimo compatible

Windows Phone 8

Espacio de nombres

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

Metadatos

Windows.winmd

Capabilities

picturesLibrary
videosLibrary
musicLibrary
documentsLibrary

Consulta también

StorageFile

 

 

Microsoft está realizando una encuesta en línea para comprender su opinión del sitio web de. Si decide participar, se le presentará la encuesta en línea cuando abandone el sitio web de.

¿Desea participar?