0

I create an email from MS Outlook template. The email looks fine and it can be edited or sent. While the new email is not yet sent, the user has no access to the other MS Outlook items. If there are other open emails, the user can't copy content from the other emails, to paste it in the new email. We also can't open any other emails from Outlook. Is there a way to create a new email, while still having access to the other functions and items of MS Outlook?

        void SendEmail() 
        {
          Microsoft.Office.Interop.Outlook.Application oApp = new 
          Microsoft.Office.Interop.Outlook.Application();
          Outlook.NameSpace nameSpace = oApp.GetNamespace("MAPI");
          Outlook.MAPIFolder folderDrafts = nameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderDrafts);

          Microsoft.Office.Interop.Outlook.MailItem mail = oApp.CreateItemFromTemplate(sTemplateName) as Microsoft.Office.Interop.Outlook.MailItem;

          mail.Subject = newSubject;
          mail.HTMLBody = newBody;

          Recipients oRecips = mail.Recipients;
          List<string> sCCRecipsList = AddRecipientsCC();

          foreach (string t in sCCRecipsList) {
            Recipient oCCRecip = oRecips.Add(t);
            oCCRecip.Type = (int)OlMailRecipientType.olCC;
            oCCRecip.Resolve();
          }         

          mail.To = someEmail;

          mail.Display(true);           
        }
Nick_F
  • 1,103
  • 2
  • 13
  • 30
  • I found the solution. The last command, mail.Display(true) should be changed to mail.Display(false). The bool expression is object Modal. – Nick_F Oct 03 '19 at 05:29

1 Answers1

0

The last line of the code should be changed to set Modal to false. mail.Display(false);

Nick_F
  • 1,103
  • 2
  • 13
  • 30