best duplicate contact remover?

Status
Not open for further replies.

mr_malkovich

Senior Member
Outlook version
Email Account
Exchange Server
Hey all. I have Outlook 2013/Office 365 on Windows 7. I need a good application to delete contact files with containing duplicate email addresses across multiple Outlook contact folders. The only criteria I have for deleting a contact is if the email in Email Field 1 is the same. Not duplicate names or companies or anything else. I want the newer contact file to be deleted. I'd like it to be a one-touch process, ie: if 300 duplicate contacts are found, I want to be able to delete them with one touch. I was using Contact Scrubber but it doesn't work with 64-bit Outlook installations, and you have to delete each duplicate contact one by one.

Is there an app for this? Or should I look around for someone to write me something custom?

Thanks much.
 
I'm not sure of any of the duplicate removers are that specific - I know mapilab's can check the fields you specify. But... if email address is the only criteria and you want to always keep the newest, VBA should work fine, although it might be slower than a compiled app. Basically, search for the email address and if matches are found, delete the ones with older created date.
 
For instance, I have several hundred contacts in one Outlook contact sub-folder and a couple thousand in another. I need some kind of application or script that will find any contact folders across those folders containing duplicate email addresses, and delete the newer of the two.
 
Do you need multiple folders? If not, it will be easier - you can drag everything to the main folder and if check for duplicates is enabled, you can merge the dupes.

This will delete the duplicates with matching emails. It doesn't check for creationtime, i tried to add an if statement to compare times but it only deletes 1 match when i use it. I'm obviously not doing something right - probably because this macro deletes the current contact, where I'm trying to compare it to the next one.

It also only works on the default contacts folder - its easy to make it work on any folder, but harder to make it check multiple folders.

Code:
Sub DeleteDuplicateContacts() 
  Dim contactItems As Outlook.Items 
  Dim contact As Outlook.ContactItem 
  Dim contactEmail As String 
  Dim filteredContacts As Outlook.Items 
  Dim countContacts As Long 
  Dim i As Long 
  Set contactItems = Session.GetDefaultFolder(olFolderContacts).Items 
  countContacts = contactItems.Count 
  For i = countContacts To 1 Step -1 
  
   If TypeName(contactItems.Item(i)) = "ContactItem" Then 
      Set contact = contactItems.Item(i) 
      contactEmail = contact.Email1Address 
If contactEmail = "" Then GoTo nexti 
      Set filteredContacts = _ 
    contactItems.Restrict("[Email1Address] = '" & contactEmail & "'") 
      If Not filteredContacts.Count = 1 Then ' possible dupe 
          contact.Delete 
      End If 
    End If 
nexti: 
  Next i 
End Sub
 
Ah, figured it out, i think. This code checks the created time and deletes the newer contact.

Code:
Sub DeleteDuplicateContacts() 
  Dim contactItems As Outlook.Items 
  Dim contact As Outlook.ContactItem 
  Dim contactEmail As String 
  Dim filteredContacts As Outlook.Items 
  Dim countContacts As Long 
  Dim i As Long 
  Dim d As Long 
  Set contactItems = Session.GetDefaultFolder(olFolderContacts).Items 
  countContacts = contactItems.Count 
  For i = countContacts To 1 Step -1 
  
   If TypeName(contactItems.Item(i)) = "ContactItem" Then 
      Set contact = contactItems.Item(i) 
      contactEmail = contact.Email1Address 
Debug.Print contactEmail 
If contactEmail = "" Then GoTo nexti 
      Set filteredContacts = _ 
    contactItems.Restrict("[Email1Address] = '" & contactEmail & "'") 
      If Not filteredContacts.Count = 1 Then ' possible dupe 
       For d = filteredContacts.Count To 1 Step -1 
       Debug.Print d 
       On Error Resume Next 
      If contact.CreationTime > filteredContacts.Item(d).CreationTime Then 
          contact.Delete 
          Else 
          filteredContacts.Item(d).Delete 
        
     End If 
    
      Next d 
    End If 
  End If 
nexti: 
  Next i 
End Sub
 
Hmmm, yeah the application that will work for me is probably going to have to work across multiple folders. I still want to try this code though. How do I actually run it? Forgive me, I know I should know this. Also, my contact files are a custom form I've created - 112607.fdm. Will that affect the code?

Thank you so much. This week has been one obstacle after another since installing O365 but I know (hope?) it's for the best in the long term.
 
It *should* work with the custom form since it looks at the item type, not the form name, but if you only have contacts - no contact groups (DLs) - you can remove this line and the corresponding End if - the only purpose it serves is to avoid errors when there are contact groups.
If TypeName(contactItems.Item(i)) = "ContactItem" Then

To use it, paste it into the VB Editor and click Run.
http://www.slipstick.com/developer/how-to-use-outlooks-vba-editor/

The debug.print lines were used for error checking, they can be deleted.

When I get a chance I'll work on making it work across multiple folders.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
cheapfaremart Which outlook version is best? Using Outlook 0
Horsepower What is best calendar practice for iMac Using Outlook 3
J What is the best EntryID format to set on MS Access table Outlook VBA and Custom Forms 3
B What is best IMAP .OST file to .PST file converter solutions? Using Outlook 1
P Best configuration for Outlook 2016, Gmail and iCloud Using Outlook 8
P Outlook room resource calendars and best practices Exchange Server Administration 0
Rupert Dragwater What is the best way to back up pst Using Outlook 4
Diane Poremsky The Best Outlook Store Add-ins Contest Using Outlook 0
Patrick van Berkel Best way to share (and keep up-to-date) Macro's in Outlook 2010 Outlook VBA and Custom Forms 6
oliv- Best practice for catching mailitem.events Outlook VBA and Custom Forms 0
M What is the best way to find all records of an e-mail for our company? Outlook VBA and Custom Forms 2
J Best approach for restarting custom task form development after seemingly corrupt form environment Outlook VBA and Custom Forms 0
X Best utility for repairing PST files? Using Outlook 3
S Best method to use Outlook Standalone with iPhone Using Outlook 13
D a suggestion ...sent with the best intentions Using Outlook 1
B What is the best way to use Outlook address book to select customer and then open Excel Outlook VBA and Custom Forms 22
M How best to track OUTGOING referrals? BCM (Business Contact Manager) 2
jobudge Reinstalled Outlook 2013 after system crash what is best way to synch with gmail? Using Outlook 1
M Best way to identify/designate contacts in incoming emails? Using Outlook 4
P Best way to locally backup/archive Gmail? Using Outlook 1
M Looking for options and best practices for an Edge Server (Exchange or not) Exchange Server Administration 0
O What are best practices for a re-install Office 13 w/BCM with OS re-install BCM (Business Contact Manager) 1
G what is the best way to organize outlook contacts Using Outlook 1
D What would be the best strategy? Using Outlook 3
crazyboy BCM Installation Best Practices? BCM (Business Contact Manager) 5
J Best way to move form old to new, larger pst? Using Outlook 2
M Best way to move outlook? Using Outlook 1
R Best way to share outlook calendar with 10 laptops Using Outlook 9
B Best way to get a pick-list on a form? Outlook VBA and Custom Forms 1
M Best way to distribute VBA project Outlook VBA and Custom Forms 4
E Where is the best place to store values for combobox entries Outlook VBA and Custom Forms 5
E Where is the best place to store values for combobox entries Outlook VBA and Custom Forms 5
T Is Explorer.FolderSwitch the best event for hiding commandbarbutton? Outlook VBA and Custom Forms 5
M Outlook 2007 / Vista / Windows XP best combo needed BCM (Business Contact Manager) 2
C Form Region, Task Pain, Ribbon Extension - which way is best? Outlook VBA and Custom Forms 1
Rupert Dragwater Duplicate email in Folder Using Outlook 7
L Duplicate calendar entries in Outlook 365 Using Outlook 3
J Recommendations for Outlook Duplicate Email Remover Using Outlook 6
D Duplicate Emails on Phone and Tablet Using Outlook 0
I Google Calendar <calendar-notification@google.com> appearing as a duplicate entry Using Outlook 2
O Delete duplicate emails - subscription notifications Using Outlook 5
T Deleting duplicate emails Using Outlook 2
S Receiving duplicate messages from RSS feeds Using Outlook 3
M Duplicate Primary Mail Accounts outlook 2010 Using Outlook 0
C Auto categorize duplicate subjects Outlook VBA and Custom Forms 11
K Outlook 2010 duplicate download emails 1 inbox 1 PST no updates Using Outlook 3
C Don't forward duplicate Using Outlook 0
E Duplicate, nested account folders on ATT server Using Outlook 10
S Duplicate emails Using Outlook 2
O Remove duplicate mail items Outlook VBA and Custom Forms 6

Similar threads

Back
Top