/// <summary> /// Deletes the specified file or folder. /// </summary> /// <remarks>This demonstrates calling an RPC style API in the Files namespace.</remarks> /// <param name="path">The path of the folder to create.</param> /// <returns>The result from the ListFolderAsync call.</returns> private async Task <bool> DeleteAsync(string path) { bool result = false; try { AppObjects.Log.Log("--- Deleting ---"); var deleteArg = new DeleteArg(path); var folder = await this.dbc.Files.DeleteV2Async(deleteArg); AppObjects.Log.Log($"{path} deleted!"); result = true; } catch (Exception ex) { AppObjects.Log.LogException(ex); } AppObjects.Log.Log("Delete Done!"); return(result); }
public static async Task DeleteFromDropbox(string dropboxSharedLink) { try { string[] pathRoutes = dropboxSharedLink.Split("/"); dropboxSharedLink = pathRoutes[pathRoutes.Length - 1]; dropboxSharedLink = dropboxSharedLink.Remove(dropboxSharedLink.Length - 6); if (pathRoutes[2] != "www.dropbox.com") { return; } using var dbx = new DropboxClient(ConfigContex.GetDropboxApiKey()); DeleteArg deleteArg = new DeleteArg("/" + dropboxSharedLink); await dbx.Files.DeleteV2Async(deleteArg); } catch (Exception) { throw; } }
/// <summary> /// <para>Begins an asynchronous send to the permanently delete route.</para> /// </summary> /// <param name="path">Path in the user's Dropbox to delete.</param> /// <param name="callback">The method to be called when the asynchronous send is /// completed.</param> /// <param name="callbackState">A user provided object that distinguished this send /// from other send requests.</param> /// <returns>An object that represents the asynchronous send request.</returns> public sys.IAsyncResult BeginPermanentlyDelete(string path, sys.AsyncCallback callback, object callbackState = null) { var deleteArg = new DeleteArg(path); return this.BeginPermanentlyDelete(deleteArg, callback, callbackState); }
/// <summary> /// <para>Permanently delete the file or folder at a given path (see /// https://www.dropbox.com/en/help/40).</para> /// </summary> /// <param name="path">Path in the user's Dropbox to delete.</param> /// <returns>The task that represents the asynchronous send operation.</returns> /// <exception cref="Dropbox.Api.ApiException{DeleteError}">Thrown if there is an error /// processing the request; This will contain a <see cref="DeleteError"/>.</exception> public t.Task PermanentlyDeleteAsync(string path) { var deleteArg = new DeleteArg(path); return this.PermanentlyDeleteAsync(deleteArg); }
/// <summary> /// <para>Begins an asynchronous send to the permanently delete route.</para> /// </summary> /// <param name="deleteArg">The request parameters.</param> /// <param name="callback">The method to be called when the asynchronous send is /// completed.</param> /// <param name="state">A user provided object that distinguished this send from other /// send requests.</param> /// <returns>An object that represents the asynchronous send request.</returns> public sys.IAsyncResult BeginPermanentlyDelete(DeleteArg deleteArg, sys.AsyncCallback callback, object state = null) { var task = this.PermanentlyDeleteAsync(deleteArg); return enc.Util.ToApm(task, callback, state); }
/// <summary> /// <para>Permanently delete the file or folder at a given path (see /// https://www.dropbox.com/en/help/40).</para> /// </summary> /// <param name="deleteArg">The request parameters</param> /// <returns>The task that represents the asynchronous send operation.</returns> /// <exception cref="Dropbox.Api.ApiException{DeleteError}">Thrown if there is an error /// processing the request; This will contain a <see cref="DeleteError"/>.</exception> public t.Task PermanentlyDeleteAsync(DeleteArg deleteArg) { return this.Transport.SendRpcRequestAsync<DeleteArg, enc.Empty, DeleteError>(deleteArg, "api", "/files/permanently_delete", DeleteArg.Encoder, enc.EmptyDecoder.Instance, DeleteError.Decoder); }
/// <summary> /// <para>Delete the file or folder at a given path.</para> /// <para>If the path is a folder, all its contents will be deleted too.</para> /// </summary> /// <param name="path">Path in the user's Dropbox to delete.</param> /// <returns>The task that represents the asynchronous send operation. The TResult /// parameter contains the response from the server.</returns> /// <exception cref="Dropbox.Api.ApiException{DeleteError}">Thrown if there is an error /// processing the request; This will contain a <see cref="DeleteError"/>.</exception> public t.Task<Metadata> DeleteAsync(string path) { var deleteArg = new DeleteArg(path); return this.DeleteAsync(deleteArg); }
/// <summary> /// <para>Delete the file or folder at a given path.</para> /// <para>If the path is a folder, all its contents will be deleted too.</para> /// </summary> /// <param name="deleteArg">The request parameters</param> /// <returns>The task that represents the asynchronous send operation. The TResult /// parameter contains the response from the server.</returns> /// <exception cref="Dropbox.Api.ApiException{DeleteError}">Thrown if there is an error /// processing the request; This will contain a <see cref="DeleteError"/>.</exception> public t.Task<Metadata> DeleteAsync(DeleteArg deleteArg) { return this.Transport.SendRpcRequestAsync<DeleteArg, Metadata, DeleteError>(deleteArg, "api", "/files/delete", DeleteArg.Encoder, Metadata.Decoder, DeleteError.Decoder); }
/// <summary> /// <para>Delete the file or folder at a given path.</para> /// <para>If the path is a folder all its contents will be deleted too.</para> /// </summary> /// <param name="deleteArg">The request parameters</param> /// <returns>The task that represents the asynchronous send operation. The TResult /// parameter contains the response from the server.</returns> /// <exception cref="Dropbox.Api.ApiException{PathError}">Thrown if there is an error /// processing the request; This will contain a <see cref="PathError"/>.</exception> public t.Task<Metadata> DeleteAsync(DeleteArg deleteArg) { return this.Transport.SendRpcRequestAsync<DeleteArg, Metadata, PathError>(deleteArg, "api", "/files/delete"); }