I'm keen to write a macro for Outlook 2003, but I can't get my head round the directory structure, (inbox, outbox etc). Where are these stored, on the hard drive or within the program? Any help would be welcome.

There are different situations here.
1. If you see Mailbox - <YourAccount> on the All Mail Folders in the Mail pane in Outlook (press Alt+F1 to reveal it), your data folders are stored either on Exchange server
2. If you see Personal Folders, your data folders are stored in the personal storage Personal Folders.pst file located in %appdata%\Microsoft\Outlook\folder
3. If you see multiple mailboxes, that means that you are using IMAP4 mailboxes to recieve your mail where each mailbox is represented by its own PST file located in the same folder as the personal folders.pst file but named by mailboxname-00x.pst convention

What do you need this macro for? There was a topic recently discussing the automation of signature management. There was noted the tool from Scriptlogic that automates the outlook configuration management. As I understood from the link given there PST management automation is one of the features the tool does with built-in tools or with additional scripting.

To access PST items you can use scripting. See this example that shows how you can get the mail from the Inbox. Here's the nice example of how you can read PST and extract data form it using VBScript.

On the PST topic see this demo discussing the Personal Folders

For an additional info on where the Outlook items are stored in read this article.

Thanks Keith.
What I'm looking to do is bounce spam back to the sender without opening the email.
I know this can be done with proprietary software but I'm keen to write my own VB code.
I'll take a close look at your recommended links and let you know how I'm getting on.

I see. Well, although I don't recommend you doing that for that purpose, if you just want to send e-mail from Outlook automatically, you can use Collaboration Data Objects (CDO). Then you can send mail using VBScript (see this short article on Windows IT Pro magazine or this Paul Sadowski site for lots of examples on scripting messaging). You also can do that with KIX scripting based on the example from Adminscripteditor and execute is with KIX processor directly or calling it with proprietary software.

Thanks again Keith.
I'll do nothing until I've read through all your recommendations.
Then I'll take all this on board and keep you in touch.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.