locked
Sending Mail from Drafts Folder - Multiple users RRS feed

  • Question

  • We have a windows desktop application that creates email and adds it to the Drafts folder of a second email account on a users Outlook 2016 (Office 365).

    User A and user B both have their own mailbox and a second accounts mailbox added to Outlook to which they have SendAs / SendOnBehalf of permissions.

    User A runs the application which creates the email, adds an attachment and saves the email in the drafts folder of the accounts mailbox. User A can open the drafts folders and click on the mail and send it no problem.

    If user B goes to the drafts folder of the accounts mailbox and selects one of the draft emails and clicks send they get a NDR saying "The recipient has been deleted or has no e-mail address" 

    If user B opens the draft email and deletes the email address and retypes it and hits send it goes?

    This what we are doing:-

    Outlook.Application application = this.OutlookApp;
        Outlook.NameSpace nameSpace = application.GetNamespace(Type: "MAPI");
        Outlook.MAPIFolder draftsFolder = nameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderDrafts);
       
         Outlook.Recipient omUser = nameSpace.CreateRecipient(emailSendFrom);
         omUser.Resolve();

         draftsFolder = nameSpace.GetSharedDefaultFolder(omUser, Outlook.OlDefaultFolders.olFolderDrafts);

        String fileName = CreatTempFile(attachement, invoiceNumber);

        var mailItem = (Outlook.MailItem) draftsFolder.Items.Add();

        mailItem.SentOnBehalfOfName = emailSendFrom;
        mailItem.To = emailTo;
        mailItem.Subject = emailSubject;
        mailItem.HTMLBody = emailBody;
        mailItem.Attachments.Add(fileName, Outlook.OlAttachmentType.olByValue, Type.Missing, Type.Missing);
        mailItem.Save();

        File.Delete(fileName);

    Any assistance much appreciated.

    Geoff

    Thursday, October 18, 2018 4:47 PM

All replies

  • Hi GeoffAuk,

    Since your question is more related to Outlook, you could post a new thread in Outlook for Development forum for suitable support.

    https://social.msdn.microsoft.com/Forums/en-US/home?forum=outlookdev&filter=alltypes&sort=lastpostdesc

    The Visual C# forum discuss and ask questions about the C# programming language, IDE, libraries, samples, and tools.

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, October 23, 2018 7:20 AM