abManager =
Components.classes["@mozilla.org/abmanager;1"].getService(Components.interfaces.nsIAbManager);
addressBook = abManager.getDirectory(expAburl);
abCards = addressBook.childCards;
I want to know how many cards are in the abCards collection. I've tried
things like abCards.length and .count but I always get undefined.
TIA
Alan
This should do the trick.
let enm = addressBook.childCards;
let count = 0;
while (enm.hasMoreElements()) {
enm.getNext();
count++;
}
Cheers -
Leni.
Thanks Leni,
I asked on #mozdev lastnight and received the same answer. I had been
expecting a facility like enm.length or enm.count() for example.
It seems a bit long-winded as the count is already displayed in the
status bar at the bottom of the Address Book Window so it does "exist"
in some form already.
But the 'iterate over and count' works so thanks again.
Al