Solved

Require VBScript to add data files / archive folders to Outlook 2007

Posted on 2011-03-01
2
993 Views
Last Modified: 2012-05-11
We have a user with several dozen pst file which we he needs to add to Outlook 2007.  There does not seem to be a way within Outlook to add more than a single data file at a time so I would like to do this via a script.

The script should add all the data files found in a folder to the logged in user's Outlook.  Can this be done?
0
Comment
Question by:canuckconsulting
2 Comments
 
LVL 11

Accepted Solution

by:
Tasmant earned 500 total points
ID: 35007649
you can try this code. It seems working, I've done few tests.
Set oOutlook = CreateObject("outlook.application")
Set oNamespace = oOutlook.GetNamespace("MAPI")
Set oFso = CreateObject("scripting.filesystemobject")

'the path where you store all PST
Const oPath = "C:\MyPSTFiles"

Set oFolder = oFso.GetFolder(oPath)
For Each oFile In oFolder.Files
	If Right(LCase(oFile.Name),4) = ".pst" Then
		oNamespace.AddStore oFile.Path
	End If
Next

Open in new window

0
 

Author Closing Comment

by:canuckconsulting
ID: 35008398
Perfect thank you!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Resolve DNS query failed errors for Exchange
Sometimes Outlook might have problems sending a message. There may be various causes- corrupted PST, AV scanner etc. The message, instead of going to the Sent Items folder, sits in the Outbox indefinitely. To remove it you can use a free tool cal…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now