CachedFileManager Class


Lets apps manage real-time updates to files.

public ref class CachedFileManager abstract sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class CachedFileManager final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
public static class CachedFileManager
Public Class CachedFileManager
Object Platform::Object IInspectable CachedFileManager

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)


The File picker sample shows you how to use a CachedFileManager to defer updates to a file until the app finishes modifying the file.

if (file != null)
    // Prevent updates to the remote version of the file until we finish making changes and call CompleteUpdatesAsync.

    // Write to file
    await FileIO.AppendTextAsync(file, "Swift as a shadow");
    // Let Windows know that we're finished changing the file so the server app can update the remote version of the file.

    // Complete updates. (May require Windows to ask for user input.)
    FileUpdateStatus status = await CachedFileManager.CompleteUpdatesAsync(file);
    switch (status)
        case FileUpdateStatus.Complete:
            // Perform additional tasks like notifying user of status

        case FileUpdateStatus.CompleteAndRenamed:
            // Perform additional tasks like notifying user of status, or storing the renamed file for future use

            // Perform additional tasks like notifying user of status

In the example, file is a local variable that contains a StorageFile that represents the file to defer updates for.


This class is static and cannot be instantiated. Call the methods directly instead.

Typically, Windows implicitly initiates updates for files that are provided by other apps when those files change.  However, you can control when updates are initiated by calling DeferUpdates. If you use this method are deferred until you call CompleteUpdatesAsync to initiate them.



Initiates updates for the specified file. This method contacts the app that provided the file to perform the updates.


Lets apps defer real-time updates for a specified file.

Applies to

See also