Share via


IStorageProviderKnownFolderSyncInfoSource.GetKnownFolderSyncInfo Method

Definition

GetKnownFolderSyncInfo is called by File Explorer whenever it needs to get the latest known folder sync status from the cloud provider.

public:
 StorageProviderKnownFolderSyncInfo ^ GetKnownFolderSyncInfo();
StorageProviderKnownFolderSyncInfo GetKnownFolderSyncInfo();
public StorageProviderKnownFolderSyncInfo GetKnownFolderSyncInfo();
function getKnownFolderSyncInfo()
Public Function GetKnownFolderSyncInfo () As StorageProviderKnownFolderSyncInfo

Returns

Returns a StorageProviderKnownFolderSyncInfo object that contains the latest known folder sync status.

Examples

The following example shows how to implement GetKnownFolderSyncInfo in a cloud provider.

StorageProviderKnownFolderSyncInfo MyKnownFolderInfoSource::GetKnownFolderSyncInfo()
{
    winrt::StorageProviderKnownFolderSyncInfo info{};
    info.ProviderDisplayName(GetProviderDisplayName());

    // Setting a SyncRequested handler to respond to user action.
    auto syncRequestHandler = [](
    winrt::CloudMirror::StorageProviderKnownFolderSyncRequestArgs const& args)
    {
        // The user wants to sync some known folders with our cloud provider.
        // We can show some UI to sign in, confirm their choice, etc.
        MyStorageProviderSyncManager::ShowFolderEnrollmentUI(args.KnownFolders(), args.Source());

        // Or we can immediately start syncing the requested folders.
        MyStorageProviderSyncManager::StartSyncingFolders(args.KnownFolders(), args.Source());
    };

    info.SyncRequested(syncRequestHandler);
    info.KnownFolderEntries().ReplaceAll(m_knownFolderEntries);

    return info;
}

Remarks

Once returned, the StorageProviderKnownFolderSyncInfo is considered immutable.

A SyncRequested handler must be set on the returned object to be considered valid and to be displayed in File Explorer.

Applies to

See also