Plug-ins > Address Book Manipulator

Get Group Names

(1/1)

gsmithosi:
Is there a way to get all the group names within the Address Book?  I see you can search for a group if you already know the group name, but I need a method that will return all groups currently existing within the Address Book.  I am hoping there is an easy way instead of stepping through each contact and picking out the group names from the contact records.  That would be a major pain.

Melinda DePalma:
Yes, you can obtain all group names in Apple Address Book by calling PCAB_GetValueForProperty( “Name” ) when performing the following searches:

1) PCAB_Search( “Group” ; “Name” ; “” ; “” ; “nil” ; “NotEqual” )  or
2) PCAB_Search( “Group” ; “Creation Date” ; “” ; “” ; “1” ; “NotWithinIntervalFromToday” )

There might also be other search criteria but the first search above is probably the most accurate to be provided with a complete list.

The "Name" field represents the name of the group. The script step PCAB_GetValueForProperty( “Name” ) must be called after the group specific function PCAB_GetFirstMemberID rather than after the record specific function PCAB_Open.

We thought this was such a great request that we modified our current FileMaker demo file available on our site in order to demonstrate how this can be accomplished. Here is a direct download link:
http://www.addressbookmanipulator.com/downloads/AddressBookManip.zip

In the new demo file you will find a new "Name" field added to the "Contacts" layout and the addition of the script step PCAB_GetValueForProperty( “Name” ) to our “Pull Group Members” script. Simply perform a Search with the following criteria PCAB_Search( “Group” ; “Name” ; “” ; “” ; “nil” ; “NotEqual” ) as shown in the screen shot below. This will gather the total number of Address Book Groups in this example there are 6 and the total number of contacts that belong to a group in this case 92. Select the "View Contacts" button to view the specific Group Name as we put the "Name" field on this layout.

gsmithosi:
I was able to make it work as desired with your direction.  Thanks.  Here are the steps to building a value list with only the group names:
 - Register
 - Search("Group"; "Name"; ""; ""; "nil"; "NotEqual")
 - OpenFirstRecord
    Loop
       - Exit loop if $ID = End
       - GetFirstMemberID
       - $ABName = $ABName & "¶" & GetValueForProperty("Name")
       - OpenNextRecord
    End Loop

 

Navigation

[0] Message Index

Go to full version