public ActionResult Sample30() { // Check is data posted if (Request.HttpMethod == "POST") { //### Set variables and get POST data System.Collections.Hashtable result = new System.Collections.Hashtable(); String clientId = Request.Form["clientId"]; String privateKey = Request.Form["privateKey"]; String fileName = Request.Form["fileName"]; result.Add("clientId", clientId); result.Add("privateKey", privateKey); result.Add("fileName", fileName); String fileId = ""; String message = null; // Check is all needed fields are entered if (clientId == null || privateKey == null || fileName == null) { // If not all fields entered send error message message = "Please enter all parameters"; result.Add("error", message); return View("Sample30", null, result); } else { String basePath = Request.Form["basePath"]; //Check is base path entered if (basePath.Equals("")) { //If base path empty set base path to the dev server basePath = "https://api.groupdocs.com/v2.0"; } result.Add("basePath", basePath); // Create service for Groupdocs account GroupdocsService service = new GroupdocsService(basePath, clientId, privateKey); Groupdocs.Api.Contract.ListEntitiesResult allFiles = service.GetFileSystemEntities("", 0, -1, null, false, null, null, false); if (allFiles.Files != null) { for (int i = 0; i < allFiles.Files.Length; i++) { if (allFiles.Files[i].Name.Equals(fileName)) { fileId = allFiles.Files[i].Guid; } } if (fileId.Equals("")) { message = "This file is no longer available"; result.Add("error", message); return View("Sample30", null, result); } else { //### Make a request to Storage Api for deleting file // Delete file bool file = service.DeleteFile(fileId); // If file downloaded successful if (file != false) { // Put fmessage to the result's list result.Add("message", "Done, file deleted from your GroupDocs Storage"); // Return to the template } // If file download failed else { // Return error to the template message = "Failed"; result.Add("error", message); } return View("Sample30", null, result); } } // If request returns error else { // Redirect to viewer with error. message = "GetFileSystemEntities returns error"; result.Add("error", message); } return View("Sample30", null, result); } } // If data not posted return to template for filling of necessary fields else { return View("Sample30"); } }