Link to home
Create AccountLog in
Avatar of HealthPartners
HealthPartnersFlag for United States of America

asked on

How to add a shared mailbox to a users Outlook profile with VB Script

I am looking for a way to automatically connect a users additional PST files and shared mailboxes in Outlook when they get a new computer. (We use Exchange) On their old computer, I have a script that creates a text file listing any additional departmental shared mailboxes and/or PST files that had setup in Outlook.  On their new computer, I want to use this text file to recreate/attach those same mailboxes.

I found the following snippet of code that I can customize to re-attach any PST files the user had on their old comptuer, but I cannot figure out how to re-attach any shared mailboxes that they may have had.   ".AddStore" will work if you give it a path to a PST file, but won't work if you enter a shared departmental mailbox name like "Accounting Mailbox".  (Like you would use if you go to Tools --> Email Accounts -->  View/Change existing Accounts -->  More Settings --> Advanced Tab-->  Add Mailbox)

Does anyone know how I can do this?  Your help would be greatly appriciated!
Dim olkApp, olkNS, objFSO, objFolder, objFile
Set olkApp = CreateObject("Outlook.Application")
Set olkNS = olkApp.GetNamespace("MAPI")
'Change the profile name on the following line as needed
olkNS.Logon "Outlook"
Set objFSO = CreateObject("Scripting.Filesystemobject")
 
 
olkNS.AddStore "C:\temp\outlook.pst"

Open in new window

Avatar of David Lee
David Lee
Flag of United States of America image

Hi, HealthPartners.

What version of Outlook are you using?
Avatar of HealthPartners

ASKER

Hi BlueDevilFan,

We are using Outlook 2003
ASKER CERTIFIED SOLUTION
Avatar of David Lee
David Lee
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Thanks for the followup BlueDevilFan.  I'll take a look at Redemption, but that might be a lot more work then it is worth for this issue.  Thanks again.  Rick
You're welcome, Rick.  Sorry there wasn't a better answer.