0
votes

I am trying to build a macro, which creates an Email (Outlook) and saves it in DRAFTS folder of the Shared Mailbox.
The macro works all as expected except that it saves the Email in DRAFTS fodler of my personal mailbox. I want it to be saved in DRAFTS folder of SharedMailbox.
Below is the code. I also tried '.SentOnBehalfOf' but with no luck.

With OutMail
    .To = "[email protected]"
    .Subject = "This is the Subject line"
    .Body = "Hi there"
    .Attachments.Add ("C:\test.txt")
    .SendUsingAccount = "[email protected]"
    .Save
End With
1

1 Answers

1
votes

You need to use the Move method of the MailItem class to move the item to the shared folder. Or you can use the Add method of the Items class which comes from the shared folder. See How to create and show a new Outlook mail item programmatically: C#, VB.NET for more information.

Use the GetSharedDefaultFolder method of the Namespace class to get a Folder object that represents the specified default folder for the specified user.