public async Task <ActionResult> Delete(string id, FormCollection collection) { _O365ServiceOperationFailed = false; try { await _mailOperations.DeleteMailItemAsync(id); } catch (Exception) { _O365ServiceOperationFailed = true; } return(RedirectToAction("Index")); }
/// <summary> /// Sends mail item remove request to the Exchange service. /// </summary> async void ExecuteDeleteMailCommandAsync() { try { if (await MessageDialogHelper.ShowYesNoDialogAsync(String.Format("Are you sure you want to delete the mail item '{0}'?", this._selectedMail.Subject), "Confirm Deletion")) { if (!String.IsNullOrEmpty(this._selectedMail.ID)) { if (await _mailOperations.DeleteMailItemAsync(this._selectedMail.ID)) { //Removes email from bound observable collection MailItems.Remove((MailItemViewModel)_selectedMail); } } } } catch (Exception) { LoggingViewModel.Instance.Information = "We could not delete your mail item."; } }
public async Task <ActionResult> Delete(string id, FormCollection collection) { IMessage deletedMail = await _mailOperations.DeleteMailItemAsync(id); return(RedirectToAction("Index")); }