adding personal folder

B

Bruce

New to outlook dev, and much to learn..

Is it possible to add a personal folder (a pst file on a local hard
drive) programmatically, and save a message to the personal folder, also
programmatically, when "send" button is pressed on a extended message
form? Thanks.

Bruce
 
E

Eric Legault [MVP - Outlook]

Hi Bruce. Something sounds strange here. Could you elaborate on what you
are trying to accomplish? I need to understand such a scenario where .pst's
are created on the fly from just sending one e-mail.

Basically, you can use the NameSpace.AddStore method to create a .pst in a
specified file path. You'd then have to find the pst you just created in
the NameSpace.Folders collection to get a handle to a specific folder where
you want to save the message to.
 
B

Bruce

Eric,

Thanx for the tips. I was able to add a personal folder with addStore.
Well... no particular scenario. I just want to know how much Outlook can
be customized. Is it possible for the messages to be added to the
personal folder, when "send" button is pressed, rather than going to the
usual outbox folder? Thanx again.

Bruce
 
E

Eric Legault [MVP - Outlook]

If you want to do this without code, select Options from the View menu, and
click the Browse button in the "Save sent message to" section and choose a
different folder to save a copy of the sent message. This is most useful of
course when you folder that you want to save a copy to constantly changes.

However, you can use code to change the default folder a message is saved to
(there's a global setting to save these messages to the Sent Items folder).
Here's a great example from the Outlook VBA Help file:

--
This Visual Basic for Applications (VBA) example sends a reply to Dan Wilson
and sets the SaveMyPersonalItems folder as the folder in which a copy of the
item will be saved after being sent. To run this example without errors,
make sure a mail item is open in the active inspector window and replace
'Dan Wilson' with a valid recipient name.

Sub SetSentFolder()
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
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top