• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 264
  • Last Modified:

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

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
murphyws
Asked:
murphyws
  • 2
1 Solution
 
David LeeCommented:
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
 
murphywsAuthor Commented:
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
 
David LeeCommented:
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

Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now