FileUpdateRequest class

Applies to Windows and Windows Phone

Provides information about a requested file update so that the app can complete the request.

Syntax


var fileUpdateRequest = fileUpdateRequestedEventArgs.request;

Attributes

[Version(0x06020000)]

Members

The FileUpdateRequest class has these types of members:

Methods

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

MethodDescription
GetDeferral Gets an object used to complete an update asynchronously.
UpdateLocalFile Provide a new version of the local file to represent the remote file.

 

Properties

The FileUpdateRequest class has these properties.

PropertyAccess typeDescription

ContentId

Read-onlyGets the unique identifier used to associate the local version of a file with the corresponding remote version.

File

Read-onlyGets a StorageFile object that represents the locally cached copy of the file to update.

Status

Read/writeGets or sets the status of the update. This property is set in response to a FileUpdateRequested event.

 

Remarks

If your app participates in the Cached File Updater contract, use this class to respond when Windows fires FileUpdateRequested events to request file updates. You can access this class from your event handler using the FileUpdateRequestedEventArgs.Request property. As a part of your response to a FileUpdateRequested event, you must set the Status property of this class to indicate the status of the update.

Learn more about responding to update requests in FileUpdateRequested and FileUpdateRequestedEventArgs.

If your app can't complete the update before returning from its FileUpdateRequested event handler, you can use the GetDeferral property to finish the update asynchronously.

Examples

The File picker contracts sample demonstrates how to respond to a FileUpdateRequested event, including how to use Request to get the FileUpdateRequest.



// Event handler
function onFileUpdateRequest(e) {
    fileUpdateRequest = e.request;
    fileUpdateRequestDeferral = fileUpdateRequest.getDeferral();

    switch (cachedFileUpdaterUI.uiStatus) {
        case Windows.Storage.Provider.UIStatus.hidden:
            fileUpdateRequest.status = Windows.Storage.Provider.FileUpdateStatus.userInputNeeded;
            fileUpdateRequestDeferral.complete();
            break;
        case Windows.Storage.Provider.UIStatus.visible:
            var url = scenarios[0].url;
            WinJS.Navigation.navigate(url, cachedFileUpdaterUI);
            break;
        case Windows.Storage.Provider.UIStatus.unavailable:
            fileUpdateRequest.status = Windows.Storage.Provider.FileUpdateStatus.failed;
            fileUpdateRequestDeferral.complete();
            break;
    }
}

// Register for the event
cachedFileUpdaterUI.addEventListener("fileupdaterequested", onFileUpdateRequest);

Both args and e (in C# and JS respectively) contain a FileUpdateRequestedEventArgs object.

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