Here's how I do it:
#import <CoreServices/CoreServices.h>
#import <Collaboration/Collaboration.h>
CSIdentityAuthorityRef defaultAuthority = CSGetLocalIdentityAuthority();
CSIdentityClass identityClass = kCSIdentityClassUser;
CSIdentityQueryRef query = CSIdentityQueryCreate(NULL, identityClass, defaultAuthority);
CFErrorRef error = NULL;
CSIdentityQueryExecute(query, 0, &error);
CFArrayRef results = CSIdentityQueryCopyResults(query);
int numResults = CFArrayGetCount(results);
NSMutableArray * users = [NSMutableArray array];
for (int i = 0; i < numResults; ++i) {
CSIdentityRef identity = (CSIdentityRef)CFArrayGetValueAtIndex(results, i);
CBIdentity * identityObject = [CBIdentity identityWithCSIdentity:identity];
[users addObject:identityObject];
}
CFRelease(results);
CFRelease(query);
//users contains a list of known Aqua-style users.
The CBIdentity
objects are much more convenient to use than the CSIdentityRef
objects, but they do require importing the Collaboration framework.