Here is the code you would use for IMailAPI_NET. Make sure this is in your project references, and you have a using
statement for it.
DomainCollection domains = new DomainCollection();
foreach (DomainData domain in domains)
// loadNow = true
// Load the collection immediately
// bLoadLite = true
// Since we're only grabbing the user counts, we don't need to fully
// load all the user data. This will populate the user objects in the
// collection with a minimal amount of data.
UserCollection users = new UserCollection(domain.HostName, true, true);
Console.WriteLine("Domain: " + domain.HostName + " UserCount: " + users.Count);