Cross Point


Collecting users

The following code snippet assumes you already have connected to a network and located a reader. This example will display all users of the reader. Note that collecting all users may take a while, so be patient while this sample executes...

The easiest method of executing this sample is to paste the code inside the sample code of Opening networks and locating readers example, just after the number of users is displayed, but before the Logoff method is called.

Refer to IUser for more properties of a single user.

// Assume that oReader holds a valid logged-on reader object.

// Collect all users (this may take some time....)
oReader.UserDatabase.CollectUsers();

// Copy all users to another object (only for readability)
var oUsers = oReader.UserDatabase.Users;
WScript.Echo("Number of collected users: " + oUsers.Count);
        
// Start with the first item in the collection
var oUser = oUsers.FirstItem;
while (oUser)
{
        // Display a messagebox with the text
        WScript.Echo("User: " + oUser.Name + ", Card: " + oUser.CardNumber + ", Level: " + oUser.LevelDescription + ", Card: " + oUser.CardTypeDescription);

        // Get the next item in the collection
        oUser = oUsers.NextItem;
}

© Copyright 2001 - 2006 Cross Point. Generated on Mon Mar 12 16:29:52 2007 Cross Point