public static async Task <bool> TryGetFileAttachmentsAsync() { var newMessageId = await EmailSnippets.CreateDraftAsync( STORY_DATA_IDENTIFIER, DEFAULT_MESSAGE_BODY, AuthenticationHelper.LoggedInUserEmail ); if (newMessageId == null) { return(false); } await EmailSnippets.AddFileAttachmentAsync(newMessageId, new MemoryStream(Encoding.UTF8.GetBytes("TryAddMailAttachmentAsync"))); // Find the sent message. var sentMessageId = await GetSentMessageIdAsync(); if (String.IsNullOrEmpty(sentMessageId)) { return(false); } await EmailSnippets.GetFileAttachmentsAsync(sentMessageId); return(true); }
public static async Task <bool> TryCreateDraftAsync() { // Create the draft message. var newMessageId = await EmailSnippets.CreateDraftAsync( STORY_DATA_IDENTIFIER, DEFAULT_MESSAGE_BODY, AuthenticationHelper.LoggedInUserEmail ); if (newMessageId == null) { return(false); } //Cleanup await EmailSnippets.DeleteMessageAsync(newMessageId); return(true); }
public static async Task <bool> TryDeleteMessageAsync() { // Create a draft message. If you send the message without first creating a draft, you can't easily retrieve the message Id. var newMessageId = await EmailSnippets.CreateDraftAsync( STORY_DATA_IDENTIFIER, DEFAULT_MESSAGE_BODY, AuthenticationHelper.LoggedInUserEmail ); if (newMessageId == null) { return(false); } // Delete the message. var isDeleted = await EmailSnippets.DeleteMessageAsync(newMessageId); return(isDeleted); }
public static async Task <bool> TryAddFileAttachmentAsync() { var newMessageId = await EmailSnippets.CreateDraftAsync( STORY_DATA_IDENTIFIER, DEFAULT_MESSAGE_BODY, AuthenticationHelper.LoggedInUserEmail ); if (newMessageId == null) { return(false); } // Pass a MemoryStream object for the sake of simplicity. using (MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes("TryAddMailAttachmentAsync"))) { await EmailSnippets.AddFileAttachmentAsync(newMessageId, ms); } return(true); }
public static async Task <bool> TryUpdateMessageAsync() { // Create a draft message. If you send the message without first creating a draft, you can't easily retrieve the message Id. var newMessageId = await EmailSnippets.CreateDraftAsync( STORY_DATA_IDENTIFIER, DEFAULT_MESSAGE_BODY, AuthenticationHelper.LoggedInUserEmail ); if (newMessageId == null) { return(false); } // Update the message. bool isUpdated = await EmailSnippets.UpdateMessageAsync( newMessageId, DEFAULT_MESSAGE_BODY); //Cleanup. Comment if you want to verify the update in your Drafts folder. await EmailSnippets.DeleteMessageAsync(newMessageId); return(isUpdated); }