FileUpdateRequest class
Provides information about a requested file update so that the app can complete the request.
Syntax
var fileUpdateRequest = fileUpdateRequestedEventArgs.request;
Attributes
- VersionAttribute(NTDDI_WIN8)
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.
| Method | Description |
|---|---|
| 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.
| Property | Access type | Description |
|---|---|---|
| Read-only | Gets the unique identifier used to associate the local version of a file with the corresponding remote version. | |
| Read-only | Gets a StorageFile object that represents the locally cached copy of the file to update. | |
| Read/write | Gets 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] |
|
Namespace |
|
|
Metadata |
|
Build date: 12/4/2012
