?
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
Medium Priority
?
256 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
[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
  • 2
5 Comments
 
LVL 76

Expert Comment

by:David Lee
ID: 22968599
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
ID: 22971806
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 2000 total points
ID: 22972171
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Changing a few Outlook Options can help keep you organized!
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
Suggested Courses

771 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