Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Find out what you should include to make the best professional email signature for your organization.
In this step by step procedure, you will come to know the details of creating an Outlook meeting in 2007, 2010, 2013 & 2016.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

860 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