?
Solved

How can we remove BCC information from Outlook .MSG files

Posted on 2009-04-24
10
Medium Priority
?
1,337 Views
Last Modified: 2012-05-06
We have some archived MSG files, and some of them contain BCC information which I have been asked to remove for security reasons.  Is there a tool to strip this information, or a way to re-save the files from Outlook?  Outlook version is 2003, and we have identified about 50 .MSG files that contain BCC information.
0
Comment
Question by:GuruGary
  • 5
  • 4
10 Comments
 
LVL 21

Expert Comment

by:JBlond
ID: 24226409
As far as I know it's not possible to edit msg files without hacking them

Someone asked a similar questions here:
http://www.experts-exchange.com/Software/Office_Productivity/Groupware/Outlook/Q_22134436.html

Maybe you can achive this with a hex editor, e. g. http://www.hhdsoftware.com/Products/home/hex-editor-free.html

0
 
LVL 76

Expert Comment

by:David Lee
ID: 24226546
Hi, GuruGary.  

There's no tool for doing this.  It's easy enough to do this though.  Double-click on a .msg file and it will open in Outlook.  Save the message into Outlook.  Once all the messages are in an Outlook folder select them all and run the following script.  It'll remove all the BCC addresses.  You'll then have to save the messages as .msg files when you're done.  

Follow these instructions to add the code to Outlook.

1.  Start Outlook
2.  Click Tools > Macro > Visual Basic Editor
3.  If not already expanded, expand Microsoft Office Outlook Objects
4.  If not already expanded, expand Modules
5.  Select an existing module (e.g. Module1) by double-clicking on it or create a new module by right-clicking Modules and selecting Insert > Module.
6.  Copy the code from the Code Snippet box and paste it into the right-hand pane of Outlook's VB Editor window
7.  Edit the code as needed.  I included comments wherever something needs to or can change
8.  Click the diskette icon on the toolbar to save the changes
9.  Close the VB Editor

Because this script accesses an address field it will trigger Outlook's buil-in security.  The result will be a dialog-box warning that a program is accessing your mailbox and asking for your permission to continue.  Say yes.
Sub RemoveAddresses()
    Dim olkMsg As Object, olkRecipient As Outlook.Recipient
    For Each olkMsg in Outlook.ActiveExplorer.Selection
        For Each olkRecipient In olkMsg.Recipients
            If olkRecipient.Type = olBCC Then
                olkRecipient.Delete
            End If
        Next 
    Next
    olkMsg.Save
    Set olkRecipient = Nothing
    Set olkMsg = Nothing
End Sub

Open in new window

0
 
LVL 10

Author Comment

by:GuruGary
ID: 24227220
Hi, BlueDevilFan.  Your solution looks like it can work for me.  I tried your suggestion, but the steps were a little different on my Outlook.  There was not a "Modules" object in the beginning, but I used "Insert Module" from one of the drop-downs on the toolbar.  When I double-click on Module1, it pulls up a new window (undocked, single-pane), but it looks like a window where your code would go.  I pasted the code, saved it and went to where I had imported the messaged into Outlook.

I selected some messages, clicked Tools -> Macro -> Macros and "RemoveAddresses" was on the list (so far, so good), but when I clicked on the "Run" button, I got "Run-time error '91'; Object variable or With block variable not set" and clicking on "debug"  highlights the olkMsg.Save line.  I tried moving the olkMsg.Save to inside the IF and also inside the FOR EACH, and they both make the error go away, but I still have the BCC.

Any ideas?
0
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

 
LVL 76

Expert Comment

by:David Lee
ID: 24227929
Apologies.  Looks like I put a line in the wrong place.  Swap the position of lines 9 and 10.
0
 
LVL 10

Author Comment

by:GuruGary
ID: 24228280
I already tried that and it didn't work.  I just tried it again, and get no error, but BCC remains.  After testing some more, I noticed that if I select a single message and run it it removes the BCC.  If I select multiple messages and run the macro it does not work on the selection.  So it is working on individual messages.  I will start going through them 1-at-a-time, but if you have any suggestions on how to get a group to go all at once, please let me know.

Thanks again for your help!
0
 
LVL 76

Expert Comment

by:David Lee
ID: 24228329
Don't doubt what you're saying, but can't imagine how it's possible.  I tested just now on multiple messages and it removed all the BCCs correctly.
0
 
LVL 10

Author Comment

by:GuruGary
ID: 24228640
I just went through them all manually.  Some still had BCC info, so I went through those again.  But I think I figured out the issue ... does the script maybe just remove 1 BCC recipient with each pass?
0
 
LVL 76

Accepted Solution

by:
David Lee earned 2000 total points
ID: 24228863
"does the script maybe just remove 1 BCC recipient with each pass"
I hadn't intended for it to, but looking back at the code I have logic error that might cause it to behave that way.  Try this version instead.
Sub RemoveAddresses()
    Dim olkMsg As Object, olkRecipient As Outlook.Recipient, intIndex
    For Each olkMsg in Outlook.ActiveExplorer.Selection
        For intIndex = olkMsg.Recipients.Count to 1 Step -1
            Set olkRecipient = olkMsg.Recipients.Item(intIndex)
            If olkRecipient.Type = olBCC Then
                olkRecipient.Delete
            End If
        Next 
        olkMsg.Save
    Next
    Set olkRecipient = Nothing
    Set olkMsg = Nothing
End Sub

Open in new window

0
 
LVL 10

Author Comment

by:GuruGary
ID: 24229423
Thanks!
0
 
LVL 76

Expert Comment

by:David Lee
ID: 24229809
You're welcome.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

As much as Microsoft wants to kill off PST file support, just as they tried to do with public folders, there are still times when it is useful or downright necessary to export Exchange mailboxes to PST files. Thankfully, it is still possible to e…
How to effectively resolve the number one email related issue received by helpdesks.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month15 days, 13 hours left to enroll

850 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