Some users would like to find all the contacts that don’t belong to any contact groups. This article will focus on this requirement to provide a quick method for it.
In my previous article “How to Quickly Find All the Contact Groups Containing a Specific Contact with Outlook VBA“, you can easily find the contact groups which a specific contact belongs to. Similar to it, at times, you may want to find out the contacts which are not in any existing contact groups. To get it, you still have to use a bit of scripting. Now, here we will expose the way to you.
Find All Contacts Not Belonging to Any Contact Groups
- At the very outset, start Outlook application.
- Then, trigger Outlook VBA editor according to “How to Run VBA Code in Your Outlook“.
- Next, in the new window, put the following code into a project or module.
Sub FindContacts_NotBelongToAnyGroups() Dim objContactsFolder As Outlook.Folder Dim i, n, x As Long Dim objContact As Outlook.ContactItem Dim objContactGroup As Outlook.DistListItem Dim objGroupMember As Outlook.Recipient 'Works in the default Contacts folder Set objContactsFolder = Outlook.Application.Session.GetDefaultFolder(olFolderContacts) For i = objContactsFolder.Items.Count To 1 Step -1 If TypeOf objContactsFolder.Items(i) Is ContactItem Then Set objContact = objContactsFolder.Items(i) objContact.User4 = "" objContact.Save For n = objContactsFolder.Items.Count To 1 Step -1 If TypeOf objContactsFolder.Items(n) Is DistListItem Then Set objContactGroup = objContactsFolder.Items(n) For x = 1 To objContactGroup.MemberCount Set objGroupMember = objContactGroup.GetMember(x) If objGroupMember.Address = objContact.Email1Address Or objGroupMember.Address = objContact.Email2Address Or objGroupMember.Address = objContact.Email3Address Then objContact.User4 = "In Group: Yes" objContact.Save End If Next End If Next End If Next End Sub
Note: Here code works only in the default Contacts folder. In this case, you should ensure that both the contacts and the contact groups are in this folder.
- Subsequently, press “F5” key button to run this macro.
- After that, exit the VBA editor and open the default Contacts folder.
- Next, press “Ctrl + E” or click into the search box above the contact list.
- In the arisen “Search” ribbon, click “Search Tools” > “Advanced Find” button.
- Then, in the newly popup dialog box, launch the searching.
- First off, switch to “Advanced” tab.
- Then, click “Fields” button and select “All Contact fields” > “User Field 4”.
- Later, select “is empty” in the “Condition” box.
- Next, click “Add to List” button.
- Then, use the same way to add another search filter: “Message Class” > “contains” > “Contact”.
- Afterwards, click “Find Now” button on the right side.
- At once, all the contacts that don’t belong to any groups will be listed below, as shown in the following figure.
Resort to External Repair Tool
Although Outlook is pre-installed with an inbox repair tool – Scanpst, you should not rely on it totally. It’s because that it will not make effects in case of the serious Outlook data corruption. At that time, you have two alternatives. One is to take aid of experienced external Outlook recovery software, like DataNumen Outlook Repair. The other one is to contact professionals for help. You can make choice as per your own case and liking.
Author Introduction:
Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including corrupt SQL Server and outlook repair software products. For more information visit www.datanumen.com
Leave a Reply