Strip BCC off existing sent email

For outlook - is there a way to run a macro on a sent folder to strip the BCC recipient from an existing email message in the sent folder?
JasonAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bill PrewCommented:
Give this a try, select the sent email you want to remove the BCC from and run this macro.

Sub ClearBcc()

    Dim Session As Object
    Dim objItem As Object
    Dim i As Long
               
    If TypeName(Application.ActiveWindow) = "Explorer" Then
        Set Session = CreateObject("Redemption.RDOSession")
        Session.MAPIOBJECT = Application.Session.MAPIOBJECT
    
        With Application.ActiveExplorer.Selection
            For i = 1 To .Count
                Set objItem = Session.GetRDOObjectFromOutlookObject(.Item(i))
                objItem.BCC = ""
                objItem.Save
            Next i
        End With
    End If
    
    Set Session = Nothing

End Sub

Open in new window


»bp
1
AlanConsultantCommented:
Hi,

Just to note, I am guessing you will have to install 'Redemption' to use Bill's code above:

http://www.dimastr.com/redemption/home.htm


Alan.
0
Bill PrewCommented:
Thanks Alan, that's a good point, I had "borrowed" an older macro I had that was changing the "LoadPictures" flag on emails.

I actually expect this could be done without Redemption since BCC should be exposed in the base object model, let me test that...


»bp
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Bill PrewCommented:
Okay, here's a version that doesn't use Redemption, which we don't need in this question...

Sub ClearBcc()

    Dim objItem As Object

    If Application.ActiveExplorer.Selection.Count > 0 Then

        For Each objItem In Application.ActiveExplorer.Selection
            If objItem.Class = olMail Then
                objItem.BCC = ""
                objItem.Save
            End If
        Next

    End If

End Sub

Open in new window


»bp
2
JasonAuthor Commented:
Thanks Bill,

That works, much appreciated.

Next question would be, is it possible to clear a single specific email address, leaving the others if there is more than one email address in the BCC field?

Jason
0
Bill PrewCommented:
Yes, we should be able to do that.

A question though, what is your goal in removing the specific email address from the sent email?  Is it just so it doesn't show in Outlook if anyone happened to view it?  Or is there more going on here than that?  Is ti prevent passing it along to a resend, or reply all or something?

The reason I ask is that information is actually stored in a couple of places in the stored email.  And depending on what your goal is may determine where we need to remove it from.


»bp
0
JasonAuthor Commented:
Hi Bill,

Thank you for your follow up.

I need to package a large number of emails into a PST file that I can share with my staff for a project they are working on, but do not want them to see the confidential recipient who was BCC'ed, but still need to maintain one visible BCC'ed email address for a bot that catalogs the emails in our database based on a file number in the subject.

So removing a specific email address from the BCC from all locations would be ideal.

Respectfully,
Jason
0
Bill PrewCommented:
Okay, let me try what I think needs to happen and see if it behaves as expected.


»bp
0
Bill PrewCommented:
Okay, this seems to work well in a test for me here, try it there.  I didn't test in an Exchange/AD environment, but hopefully it works there as well.

Sub ClearBcc()

    ' Declare local variables
    Dim objItem As Object
    Dim objRecipient As Outlook.Recipient
    Dim blnSave As Boolean
    Dim i As Long
    
    ' Specify the email address to remove from the BCC list
    Const strBCC = "username@domain.com"

    ' Make sure at least one email is selected
    If Application.ActiveExplorer.Selection.Count > 0 Then

        ' Look at each selected email
        For Each objItem In Application.ActiveExplorer.Selection
            
            ' Make sure it's an email item
            If objItem.Class = olMail Then
                
                ' Assume no changes made to this email
                blnSave = False
                
                ' Look at each item in the recipients collection
                For i = objItem.Recipients.Count To 1 Step -1

                    Set objRecipient = objItem.Recipients(i)

                    ' It is is a BCC item, and matches the email address we want to remove, delete it
                    If objRecipient.Type = olBCC And LCase(objRecipient.Address) = LCase(strBCC) Then
                        objRecipient.Delete
                        blnSave = True
                    End If
                    
                Next
                
                ' If we made a change to the email save it
                If blnSave Then
                    objItem.Save
                End If
            
            End If
        
        Next

    End If

End Sub

Open in new window


»bp
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JasonAuthor Commented:
Hi Bill,

That last macro seems to work perfectly!

Thank you very much!!

Jason
0
Bill PrewCommented:
Great, glad that was useful.


»bp
0
JasonAuthor Commented:
Much appreciated!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Outlook

From novice to tech pro — start learning today.