Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2011-03-01
2
Medium Priority
?
1,081 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 2000 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
This article describes how to import an Outlook PST file to Office 365 using a third party product to avoid Microsoft's Azure command line tool, saving you time.
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…
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…

916 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