function zpa_get_userlist($adminStore) { $companies = mapi_zarafa_getcompanylist($adminStore); if (is_array($companies)) { foreach ($companies as $company) { $users = mapi_zarafa_getuserlist($adminStore, $company['companyid']); _zpa_get_userlist_print($users, $company['companyname']); } } else { _zpa_get_userlist_print(mapi_zarafa_getuserlist($adminStore), "Default"); } }
$storeEntryid = $row[PR_ENTRYID]; } } if (!$storeEntryid) { exit("Can't find default store\n"); } // open default store $store = mapi_openmsgstore($session, $storeEntryid); if (!$store) { exit("Unable to open system store\n"); } if (strcasecmp($argv[1], "-a") == 0) { // get all zarafa users and remove property data $userList = array(); // for multi company setup $companyList = mapi_zarafa_getcompanylist($store); if (mapi_last_hresult() == NOERROR && is_array($companyList)) { // multi company setup, get all users from all companies foreach ($companyList as $companyName => $companyData) { $userList = array_merge($userList, mapi_zarafa_getuserlist($store, $companyData["companyid"])); } } else { // single company setup, get list of all zarafa users $userList = mapi_zarafa_getuserlist($store); } if (count($userList) <= 0) { exit("Unable to get user list\n"); } foreach ($userList as $userName => $userData) { // check for valid users if ($userName == "SYSTEM") {
function getuserlist() { $this->companylist = mapi_zarafa_getcompanylist($this->defaultstore); if (mapi_last_hresult() == NOERROR && is_array($this->companylist)) { // multi company setup, get all users from all companies if ($this->options->company != "") { foreach ($this->companylist as $companyName => $companyData) { if ($companyName == $this->options->company) { $this->userlist = mapi_zarafa_getuserlist($this->defaultstore, $companyData["companyid"]); break; } } } else { // Sanity check: multi-company setup, but no company in options print "Running in a multi-company environment, but no company specified in command line.\n"; exit(RESULT_ERROR_NOCOMPANYSPECIFIED); } } else { // single company setup, get list of all zarafa users print "Getting user list\n"; $this->userlist = mapi_zarafa_getuserlist($this->defaultstore); } if (count($this->userlist) <= 0) { print "Unable to get user list\n"; exit(RESULT_ERROR_USERLIST); } }
/** * Returns a list of Global Address Books with their names and ids. * * @access protected * @return array */ protected function getGABs() { $names = array(); $companies = mapi_zarafa_getcompanylist($this->store); if (is_array($companies)) { foreach ($companies as $c) { $names[trim($c['companyname'])] = bin2hex($c['companyid']); } } return $names; }