Solved

With Visual Basic, how do I find and remove duplicate messages from Outlook 2007 Folders that identical with the exception of the Received time?

Posted on 2008-10-30
5
247 Views
Last Modified: 2012-05-05
My Outlook Folders and subfolders contain duplicate copies of many messages that are identical with the exception of the time Received field.  For some unknown reason the server sent duplicate copies and my Outlook client accepted them as new messages. I want to identify the duplicate messages and delete the duplicate copy. I want to ensure that the only difference between the deleted message and the retained message is the Received time. I do not want to delete two messages from the same sender with the same subject where the message contents are different. Sample header information from three messages is shown below. Two of the messages are duplicates with different received times.  The third message has the same subject and received times as one of the duplicate messages, but a different message body. Other messages in my Outlook Folders are identical and share the same Received time. I also want to delete the duplicate copy of the messages that share the same Received time. Will you please share your Visual Basic code with me that will automate this duplicate file identification and deletion process?

From: sender@sent.com
To: receiver@received.com
Subject: Message with two different received times
Received: Tuesday, October 28, 2008 11:33 PM
Size: 62K
Message: This is a test message that was received at two different times. I want to use a macro to identify the duplicate copy and delete it.

From: sender@sent.com
To: receiver@received.com
Subject: Message with two different received times
Received: Tuesday, October 28, 2008 11:34 PM
Size: 62K
Message: This is a test message that was received at two different times. I want to use a macro to identify a the duplicate copy and delete it.

From: sender@sent.com
To: receiver@received.com
Subject: Message with two different received times
Received: Tuesday, October 28, 2008 11:34 PM
Size: 62K
Message: This is not a duplicate message and should not be deleted by the macro.
0
Comment
Question by:murphyws
  • 2
5 Comments
 
LVL 76

Expert Comment

by:David Lee
Comment Utility
Hi, murphyws.

I might be able to help with this.  Does the solution need to check for duplicates in every mail folder you have or only certain ones?
0
 

Author Comment

by:murphyws
Comment Utility
HI BlueDevilFan:

I appreciate your interest in helping. Yes the solution needs to check for duplicates in every mail folder.

The initial mental model I used to file Emails into pst files was flawed and I am trying to recover. Eventually I hope to get to the point where all Emails associated with a specific topic are in a single pst file, but I am not anywhere close to being there yet.

Regards,
Bill
0
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
Comment Utility
Hi, Bill.

Finding all duplicates in all folders and eliminating all but one of them isn't simple.  I thought about it for awhile and concluded that it's best to leave the decision making to a human intelligence: you.  The solution I propose, and the one I've uploaded here, builds a spreadsheet of all the files in all folders, then sorts them by Subject, Sender, and Size.  This information is presented to you along with the date/time you received the message and the path to the folder the item is in.  With this information comes two buttons cells labeled VIEW and DELETE.  You then review the sheet using your intelligence to pick out duplicates.  When you find one you can double-click the VIEW cell next to a message to view the message, or double-click DELETE to delete the message.  When you delete an item that row in the spreadsheet turns red to let you know the item's bee deleted.  Here's how to use this.

1.  Download the attached file
2.  Unzip the spreadsheet
3.  Change the file extension on the spreadsheet from xls to xlsm (I had to use xls to upload it here)
4.  Open the spreadsheet
5.  Run the macro named DupCheckController
6.  Wait for the macro to finish (a dialog-box will tell you it's finished).  Be patient, depending on the number of folders and messages you have this may take awhile
7.  Review the list of messages
8.  To view a message, double-click on the cell containing the word VIEW
9.  To delete a message, double-click on the cell containing the word DELETE

The far right-hand column (column H) of each line is the EntryID of the message for that line.  DO NOT edit or remove these cells.  EntryID is the unique identifier for a message.  If you sort the results be sure to include this column in the selection.  When you double-click VIEW or DELETE the code reads this cell and uses it to get the corresponding message.
DupCheck.zip
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Email signatures have numerous marketing benefits. Here are 8 top reasons to turn your email signature into a marketing channel.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This video walks the viewer through the process of creating an MLA formatted document, as well as a bibliography with citations.
This video shows the viewer how to set up and create Footnotes in their document. Click on the References tab: Select "Insert Footnote": Type in desired text:

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now