Need to Import Info from a PST file via VBA

R

RDI

I need to import info (contains one folder with contacts) via VBA is this
possible? Can someone point me in the right direction?

I've done some TurboC programming (many years) and some AutoLisp (for
AutoCad) programming. But I've never really done any VBA programming and
I'm not quite sure where to start.

TIA
 
K

Ken Slovak - [MVP - Outlook]

The best place to start is by searching on Slipstick
(www.slipstick.com) for existing code samples.

Outlook has an AddStore method that lets you add a PST file if you
know its path to an open Outlook session. You then get the Folders
collection of that PST file and locate your contacts folder and its
Items collection. Then you can iterate the Items collection, get each
contact, and use the Add method for the Items collection of the target
contacts folder.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm
 
K

Ken Slovak - [MVP - Outlook]

A PST file can only be opened by one person at a time, even if the
"person" is code. You can certainly copy a PST file somewhere and then
open it if you have the path of the copy but then you get into
possible file consistency problems.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm
 
R

RDI

OH--That kinda makes sense.

However the PST file can be updated ONLY by one person in our office. If
someone has a contact to add/update/delete he/she has to send a request to
this person. Once the PST file has been updated, she'll send out an email.

I'm writing a function that will delete all contacts from the appropriate
folders and then import this updated PST file.

I'm planning to create a message rule that runs my function when this
message arrives.

--

RDI

(remove the exclamation from the email address)

Ken Slovak - said:
Consistency problems in the sense that if you open the PST and someone
else opens another copy of it and you both change something, which
version is posted to the original PST? It's the standard database
access question, where multiuser databases do file, record or row
locking when someone has a table open.

A COM addin or VBA code can run a script or bat file by using Shell or
by call the Run function from Windows Scripting.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm

RDI said:
Ken thanks for the assistance thus far. I'm not sure what kind of
"consistency problems" you are referring to. If one PST were to be copied
from one central location to the SAME location on your hard drive and then
loaded in, what kind of problems could I expect?

Also, can my COM add-in or VBA function call a batch file to perform this
task?
 

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