Solved

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

Posted on 2011-03-01
2
1,006 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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What does UTC stand for?  “Coordinated Universal Time” – Think of this as the true time on Planet Earth that never changes with the exception of minor leap seconds here and there to account for the changes in the planet's rotation.   What does th…
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
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: …
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

770 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