Click or drag to resize
GDStorageFolderGetItemsAsync Method
Gets all the files and subfolders in the current folder.

Namespace:  GD
Assembly:  GD (in GD.dll) Version: 255.255.255.255
Syntax
public IAsyncOperation<IReadOnlyList<IGDStorageItem>> GetItemsAsync()

Return Value

Type: IAsyncOperationIReadOnlyListIGDStorageItem

When this method completes successfully, it returns a list of the files and folders (type IVectorView) in the folder. Each file in the list is represented by a IGDStorageItem object.

To work with the returned item, call the IsOfType method of the IGDStorageItem interface to determine whether the item is a file or a folder. Then cast the item to a GDStorageFolder or GDStorageFile.

Implements

IGDStorageFolderGetItemsAsync
Exceptions
ExceptionCondition
AccessDeniedException(C# equivalent: System.UnauthorizedAccessException) Secure storage was remotely wiped.
Remarks

Call the IsOfType method of the IGDStorageItem interface to determine whether the returned item is a file or a folder.

This query is a shallow query that returns only items in the current folder.

To get only files, call the GetFilesAsync method. To get only folders, call the GetFoldersAsync method.

Examples
The following example shows how to get the files and subfolders in the current folder.
using GD;

// Get the files and folders in the current folder.
var items = await GDWindows.Instance.SecureFolder.GetItemsAsync();

// Iterate over the results and print the list of items to the Visual Studio Output window.
foreach (IGDStorageItem item in items) 
{
    if(item.IsOfType(StorageItemTypes.Folder))
        Debug.WriteLine("Folder: " + item.Name);
    else
        Debug.WriteLine("File: " + item.Name + ", " + item.DateCreated);
}
See Also