File access sample

This sample shows how to create, read, write, copy and delete a file, how to retrieve file properties, and how to track a file or folder so that your app can access it again. This sample uses Windows.Storage and Windows.Storage.AccessCache API.

 
 
 
 
 
(32)
99.297 volte
Aggiungi a Preferiti
09/04/2013
E-mail del.icio.us Digg Facebook Reddit Slashdot Twitter Windows Live Favorites Windows Live Spaces

Esplora soluzioni

C++
C#
JavaScript
VB.NET
//// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
//// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
//// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
//// PARTICULAR PURPOSE.
////
//// Copyright (c) Microsoft Corporation. All rights reserved

(function () {
    "use strict";

    var page = WinJS.UI.Pages.define("/html/scenario1.html", {
        ready: function (element, options) {
            document.getElementById("createFile").addEventListener("click", createFile, false);
        }
    });

    function createFile() {
        Windows.Storage.KnownFolders.documentsLibrary.createFileAsync("sample.dat", Windows.Storage.CreationCollisionOption.replaceExisting).done(
        function (file) {
            SdkSample.sampleFile = file;
            var outputDiv = document.getElementById("output");
            outputDiv.innerHTML = "The file '" + SdkSample.sampleFile.name + "' was created.";
        },
        function (error) {
            WinJS.log && WinJS.log(error, "sample", "error");
        });
    }
})();