Rename a PST within Outlook

Is there a program or script that can rename PST's.  When I open a PST in Outlook through File>Open>Outlook Data File... The PST opens as "Personal Folders" and of course I can go to the Properties, Advanced and rename it in the Name field but I have a few hundred I need to do and would prefer not to do this manually.
helpdesk_compsychAsked:
Who is Participating?
 
KimputerConnect With a Mentor Commented:
This should help you along:

Sub test()

Dim objOutlook As Object
Dim objNameSpace As Object
    
Set objOutlook = CreateObject("Outlook.Application")
Set objNameSpace = objOutlook.GetNamespace("MAPI")
     
For Each Folder In objNameSpace.Folders
    If Folder.Name = "Personal Folders" Then
        Folder.Name = "xxx"
    End If
    
Next
 
 
 
End Sub

Open in new window


Potentially, you could open ALL pst files in a folder, and have them renamed based on the filename of the PST file.
It has to be named "Personal Folders" already though, and no other PST file should be open.
0
 
Alexei Kuznetsov (Outlook MVP)CEOCommented:
What is the rule for renaming?
0
 
QlemoDeveloperCommented:
What is the reason behind opening hundreds of PST files?
0
 
helpdesk_compsychAuthor Commented:
Recovering mailbox data
0
 
QlemoConnect With a Mentor DeveloperCommented:
Then probably the approach by using the filename in a VBA macro is the best.
0
All Courses

From novice to tech pro — start learning today.