예제 #1
0
        public static async Task <bool> TryCopyFileAsync()
        {
            // Grab the root folder.
            var items = await FilesSnippets.GetFolderChildrenAsync("root");

            if (items == null)
            {
                return(false);
            }

            // Create a new file.
            var createdFileId = await FilesSnippets.CreateFileAsync(STORY_DATA_IDENTIFIER + "_" + Guid.NewGuid().ToString(), new MemoryStream(Encoding.UTF8.GetBytes("TryAddFileAsync")));

            if (createdFileId == null)
            {
                return(false);
            }

            // Create a new folder in the root folder.
            var folder = await FilesSnippets.CreateFolderAsync(STORY_DATA_IDENTIFIER, "root");

            // Copy the new file into the new folder.
            var copiedFileId = await FilesSnippets.CopyFileAsync(createdFileId, folder.Id);

            // Clean up.
            // Comment out if you want to see the file, the folder, and the copied file.
            await FilesSnippets.DeleteFileAsync(createdFileId);

            // Deleting the folder also deletes the file copied into it.
            await FilesSnippets.DeleteFolderAsync(folder.Id);


            return(true);
        }
예제 #2
0
        public static async Task <bool> TryDeleteFolderAsync()
        {
            var folder = await FilesSnippets.CreateFolderAsync(STORY_DATA_IDENTIFIER, "root");


            var result = await FilesSnippets.DeleteFolderAsync(folder.Id);

            return(result);
        }
예제 #3
0
        public static async Task <bool> TryCreateFolderAsync()
        {
            var folder = await FilesSnippets.CreateFolderAsync(STORY_DATA_IDENTIFIER, "root");

            //Cleanup. Comment if you want to see the new folder under your root folder.
            await FilesSnippets.DeleteFolderAsync(folder.Id);

            return(folder != null);
        }