Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving sent emails to another folder with Outlook

Status
Not open for further replies.

StewartUK

Programmer
Feb 19, 2001
860
GB
Thanks to thread1251-1027786, I have found out about using the SentOnBehalfOfName property which almost works fine.

For example, say my email address is [ignore]joe@somewhere.com[/ignore] and I want to send an email from the mailbox [ignore]pete@somewhere.com[/ignore]

I found that pete has to give joe permission to do this. Once that is given, if joe's puts [ignore]pete@somewhere.com[/ignore] in the SentOnBehalfOfName property, the email is sent from pete.

However, it saves the copy into joe's sent items folder.

What I would like to do is save the email into pete's Sent Items folder.

I found this...
Dim myItem As Outlook.MailITem
Dim myResponse As Outlook.MailITem
Dim mpfInbox As Outlook.MAPIFolder
Dim mpf As Outlook.MAPIFolder

Set mpfInbox = Application.Session.GetDefaultFolder(olFolderInbox)
Set mpf = mpfInbox.Folders.Add("SaveMyPersonalItems")
Set myItem = Application.ActiveInspector.CurrentItem
Set myResponse = myItem.Reply
myResponse.Display
myResponse.To = "Dan Wilson"
Set myResponse.SaveSentMessageFolder = mpf
myResponse.Send
...in the VBA help but don't entirely understand it!


I'll keep on digging myself, but if anyone has any pointers on this, I'd be grateful.

Thanks,

Stewart
 
See Usefull functions with Outlook Automation
faq184-3894

Brian
 
A translation of the VB code might look like this (You cannot use the Application.ActiveInspector.CurrentItem in VFP.

Code:
Public o
o = Createobject("outlook.application")
ns = o.GetNamespace("Mapi")
mpfInbox = ns.getdefaultfolder(6)
mpf = mpfInbox.Folders.Add("SaveMyPersonalItems")
myItem = mpfInbox.items(1)
myResponse = myItem.Reply
myResponse.To = "Dan Wilson"
myResponse.SaveSentMessageFolder = mpf
myResponse.Send



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
ReFox XI (www.mcrgsoftware.com)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top