Esempio n. 1
0
        /// <summary>
        /// Deletes file or entire folder(with or without content).
        /// </summary>
        /// <param name="path">If the target is a folder - path to the folder. Example: "/Contests/Active".
        /// If the target is file - the path includes the filename and extension. Example: "/Contests/Active/Abstract5567.jpg"
        /// The path is relevant to the root Dropbox folder - i.e. the path always starts with "/"
        /// </param>
        /// <returns>On success returns true, otherwise false.</returns>
        public static async Task <bool> Delete(string path)
        {
            using (var dbx = new DropboxClient(DropboxAppAccessToken))
            {
                var  folderArg = new Dropbox.Api.Files.DeleteArg(path);
                bool success   = true;
                try
                {
                    var folder = await dbx.Files.DeleteAsync(folderArg);
                }
                catch (Exception)
                {
                    success = false;
                }

                return(success);
            }
        }
        /// <summary>
        /// Deletes file or entire folder(with or without content). 
        /// </summary>
        /// <param name="path">If the target is a folder - path to the folder. Example: "/Contests/Active".
        /// If the target is file - the path includes the filename and extension. Example: "/Contests/Active/Abstract5567.jpg"
        /// The path is relevant to the root Dropbox folder - i.e. the path always starts with "/" 
        /// </param>
        /// <returns>On success returns true, otherwise false.</returns>
        public static async Task<bool> Delete(string path)
        {
            using (var dbx = new DropboxClient(DropboxAppAccessToken))
            {
                var folderArg = new Dropbox.Api.Files.DeleteArg(path);
                bool success = true;
                try
                {
                    var folder = await dbx.Files.DeleteAsync(folderArg);
                }
                catch (Exception)
                {
                    success = false;
                }

                return success;
            }
        }