Get list of all users on a domain


I was wondering if anyone knew of a way to retrieve all of the registered users on a server. ie. Instead of adding people to my roster by hand, I would like to be able to just search the server for all users listed on that server domain and make that my roster…any ideas? I have read other posts and it seems that it is a security feature built into the protocol that makes this impossible, but I did see where you can use shared groups to make this work. Does anyone know how to create and add users to groups in code? I have looked through the entire API and can’t find anything. I am assuming it is something in the registration process.