StorageLibrary.AreFolderSuggestionsAvailableAsync StorageLibrary.AreFolderSuggestionsAvailableAsync StorageLibrary.AreFolderSuggestionsAvailableAsync StorageLibrary.AreFolderSuggestionsAvailableAsync StorageLibrary.AreFolderSuggestionsAvailableAsync Method

Definition

Determines if there are suggestions for adding existing folders with content to the StorageLibrary.

public : IAsyncOperation<Platform::Boolean> AreFolderSuggestionsAvailableAsync()
IAsyncOperation<bool> AreFolderSuggestionsAvailableAsync() const;
public IAsyncOperation<bool> AreFolderSuggestionsAvailableAsync()
Public Function AreFolderSuggestionsAvailableAsync() As IAsyncOperation(Of bool)
Windows.Storage.StorageLibrary.areFolderSuggestionsAvailableAsync().done( /* Your success and error handlers */ );

Returns

True if there are folder suggestions; False otherwise

Additional features and requirements

Device family
Windows 10 Fall Creators Update (introduced v10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)

Examples

This example demonstrates how to determine whether there are any suggested folders with content that can be added to your Pictures library.

private async Task<StorageLibrary> SetupPicturesLibraryAsync()
{
    if (this.picturesLibrary == null)
    {
        this.picturesLibrary = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Pictures);
        this.picturesLibrary.DefinitionChanged += PicturesLibrary_DefinitionChanged;
    }
    return this.picturesLibrary;
}

private async void CheckForFolderSuggestions_Clicked(object sender, RoutedEventArgs e)
{
    var library = await SetupPicturesLibraryAsync();

    if (await library.AreFolderSuggestionsAvailableAsync())
    {
        // There are new folders that could be added to the library.
        // Prompt the user to add one or more of them. 

        // Note that the RequestAddFolderAsync method returns only one folder.
        // If the user adds multiple folders, only one will be returned.
        // In this example, to keep track of all the added folders, the app can subscribe to the
        // StorageLibrary.DefinitionChanged event by awaiting library.RequestAddFolderAsync();

        // Launch the folder suggestion dialog
        var folder = await library.RequestAddFolderAsync(); 
    }
}

private void PicturesLibrary_DefinitionChanged(StorageLibrary sender, object args)
{
    foreach (StorageFolder folder in sender.Folders)
    {
        // Do something with every folder in the library
    }
}

Note

Don't forget to include the picturesLibrary capability in your app's package manifest. For more information on Capabilities in the manifest, see App capability declarations.

Remarks

If this feature is not supported on your version of Windows, the method will return false.