HTML and CSS Reference
In-Depth Information
Note also that developers are not entitled to suggest programmatically any start folder not listed
in the PickerLocationId enumeration. By design, only the predefined system folders can be presented
to the user. The PickerLocationId enumeration includes the folders listed in Table 9-3.
TABLE 9-3 Predefined system folders
Location
Description
The folder that provides access to all disks and connected devices.
computerFolder
The Windows desktop.
desktop
The user's Documents folder.
documentsLibrary
The folder where software is downloaded by default.
downloads
The folder that provides access to all computers in the home group.
homeGroup
The Music library folder.
musicLibrary
The Pictures library folder.
picturesLibrary
The Videos library folder.
videosLibrary
Similarly, you can suggest the name for the file to be saved. You do that through the Suggested-
FileName property. In the example above, you set the suggested file name to the description of the
task being created:
savePicker.suggestedFileName = currentTask.description;
Another parameter you can customize is the list of extensions recommended for the file being
created. In this case, you provide the .todo custom extension:
savePicker.fileTypeChoices.insert("TodoList Task", [".todo"]);
The commitButtonText property sets the caption of the button the user will need to click to save
content.
Getting the name of the file to create
To display the user interface through which the user will be able to select a file to save, you need to
add the following code to the body of the TodoList.pickFileAndSaveTask function.
// Invoke the file picker
savePicker.pickSaveFileAsync().then(function (file) {
if (file) {
TodoList.alert(file.name);
}
});
 
Search WWH ::




Custom Search