Solved

search and replace special characters in outlook folder names

Posted on 2013-11-04
1
508 Views
Last Modified: 2013-11-14
Hi

I encourage my clients as much as I can to upgrade to online IMAP accounts

I often in the process have to transfer large quantities of data in the form of client emails
up to their new accounts

Forward slashes and periods wreak havoc during the transfer process, and slow everything down when one has to stop to analyze and determine what is still left to be uploaded

But some client folder structures are so immense that I could spend weeks sifting through them and still miss one of these troublesome characters.

Is there a way to automate the replacement of these characters throughout a PST or folder structure ? An Outlook macro maybe ?

any ideas ?

thanks

yann
0
Comment
Question by:Yann Shukor
[X]
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
1 Comment
 
LVL 22

Accepted Solution

by:
rspahitz earned 500 total points
ID: 39623466
You can try something like this:
Private Sub ShowAccountFolders()
    Dim pstFolders As Folders
    Dim objFolder As MAPIFolder
    Dim pstExplorers As Explorers
    Dim pstExplorer As Explorer
    Dim obj As Object
    Dim iExplorerCntr As Integer
    Dim iFolderCntr As Integer
    
    On Error Resume Next
    
    Set pstExplorers = Outlook.Application.Explorers
    For iExplorerCntr = 1 To pstExplorers.Count
        Set pstExplorer = pstExplorers.Item(iExplorerCntr)
        Set objFolder = pstExplorer.CurrentFolder
            
        Debug.Print objFolder.Name ', objFolder.Views.Count, objFolder.DefaultItemType
        Set pstFolders = objFolder.Folders
        ShowSubFolders pstFolders, 1
        Debug.Print
    Next
    
    Set pstExplorers = Nothing
End Sub

Private Sub ShowSubFolders(FolderObject As Folders, Level As Integer)
    Dim pstFolders As Folders
    Dim iFolderCntr As Integer
    Dim strIndent As String
    
    strIndent = String(Level, vbTab)
    For iFolderCntr = 1 To FolderObject.Count
        Debug.Print strIndent; FolderObject(iFolderCntr).Name
        
        If FolderObject(iFolderCntr).Folders.Count > 0 Then
            ShowSubFolders FolderObject(iFolderCntr).Folders, Level + 1
        End If
        
        FolderObject(iFolderCntr).Name = UpdateName(FolderObject(iFolderCntr).Name)
    Next
End Sub

Private Function UpdateName(StartingName As String) As String
    Dim strNewName As String
    
    strNewName = StartingName ' apply filtering of characters, etc.
    UpdateName = strNewName
End Function
    

Open in new window


You will need to:
1) Enable macros in Outlook
2) Click on the top-level folder ("Personal Folders")
3) Update the "UpdateName" routine to handle any of the adjustments you need, such as removing any apostrophes, replacing double-quotes with single quotes, etc.
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Suggested Solutions

MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
This Micro Tutorial demonstrates  how Internet marketers work with competitive analysis data, and a common task in data preparation is creating separate column for domains. You will then extract from a list of URLs.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

749 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