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);
     }
 }
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");
    }
}
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") {
            continue;
        }
        $result = clearSuggestionList($session, $store, $userName);
        if ($result) {
            print "Suggestion list cleared for user - " . $userName . "\n\n";
        } else {
            print "Not able to clear suggestion list for user - " . $userName . "\n\n";
        }