?
Solved

search and replace special characters in outlook folder names

Posted on 2013-11-04
1
Medium Priority
?
533 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 1000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article will help to fix the below errors for MS Exchange Server 2013 I. Certificate error "name on the security certificate is invalid or does not match the name of the site" II. Out of Office not working III. Make Internal URLs and Externa…
In this article I discuss my selections of the Top Four free Outlook OST File Viewers available. Open, view and read even damaged OST files by using these tools. They all provide a clear preview of all data such as emails, notes, tasks, calendars, e…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
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 …
Suggested Courses

801 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