In this article, We learn how to create get access token for azure management API. I will show how to do it, and just follow the steps clearly.

For more updates please do Subscribe via Email:

Using C#, you are able to compose email and save in your draft in outlook mail box.

First create a project in your visual studio. After creating the project proceed to Dependencies or references.

And right click and hit the Add Project Reference..

  1. In reference manager, Select COM tab.
  2. Find the Microsoft Outlook 16.0 Object Library.
  3. Hit OK button.

Here the library is being imported in your project.

This is the full source of code to compose and save the mail draft in your outlook mail account.

 public async Task composeEmailSaveDraft_COM()
        {
            Microsoft.Office.Interop.Outlook.Application app = new Microsoft.Office.Interop.Outlook.Application();
            Microsoft.Office.Interop.Outlook._NameSpace ns = null;
            //Microsoft.Office.Interop.Outlook.Account smtpAddress = null;
            Microsoft.Office.Interop.Outlook.MAPIFolder draftsFolder = null;

            ns = app.GetNamespace("MAPI");
            draftsFolder = ns.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderDrafts);

            Microsoft.Office.Interop.Outlook.MailItem email = draftsFolder.Items.Add("IPM.NOTE");
            email.Subject = "Testing in C#";
            email.HTMLBody = "Test draft email";
            email.Recipients.Add("recipientEmails@mail.com");
            email.Recipients.ResolveAll();
            email.UnRead = true;
            email.Save();
        }

Happy Learning..

Thank you for visiting my blog site. Hoping you learn more here. please feel free to comment and suggest if there is need to enhance and update. thank you.

Related Topics

Leave a Reply

Your email address will not be published. Required fields are marked *