CachedFileUpdater class

Applies to Windows and Windows Phone

Manages files so that they can be updated in real-time by an app that participates in the Cached File Updater contract.

Syntax


var cachedFileUpdater = Windows.Storage.Provider.CachedFileUpdater;

Attributes

[MarshalingBehavior(Agile)]
[Version(0x06020000)]

Members

The CachedFileUpdater class has these types of members:

Methods

The CachedFileUpdater class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

MethodDescription
SetUpdateInformation Configures update policies for a local file.

 

Remarks

Access methods in this class statically.

Examples

The File picker contracts sample demonstrates how to set update information for a file in its TargetFileRequested event handler.


function onTargetFileRequested(e) {
    var deferral;
    deferral = e.request.getDeferral();

    Windows.Storage.ApplicationData.current.localFolder.createFileAsync(fileSavePickerUI.fileName, Windows.Storage.CreationCollisionOption.replaceExisting).done(
        function (file) {
            // Set update info for the file
            Windows.Storage.Provider.CachedFileUpdater.setUpdateInformation(
                file,
                "CachedFile",
                Windows.Storage.Provider.ReadActivationMode.notNeeded,
                Windows.Storage.Provider.WriteActivationMode.afterWrite,
                Windows.Storage.Provider.CachedFileOptions.requireUpdateOnAccess
            );

            // Assign the resulting file to the targetFile property and complete the deferral to indicate success
            e.request.targetFile = file;
            deferral.complete();
        }, function () {
            // Set the targetFile property to null and complete the deferral to indicate failure
            e.request.targetFile = null;
            deferral.complete();
        }
    );
};

Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

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

Metadata

Windows.winmd

 

 

Show:
© 2014 Microsoft