WebMail Pro 7 documentation

Contacts

API reference on CApiContactsManager class

Contacts manager provides all the methods required for manipulating contacts and groups. The approach for invoking API manager for contacts is a common point for any methods listed here:

include_once '/var/www/webmail/libraries/afterlogic/api.php';
if (class_exists('CApi') && CApi::IsValid()) {
    $oApiContactsManager = CApi::Manager('contacts');
    ...
} else {
    echo 'AfterLogic API isn\'t available';
}

The following sample code will import contacts from CSV file into the specific account.

include_once '/var/www/webmail/libraries/afterlogic/api.php';
if (class_exists('CApi') && CApi::IsValid()) {
    $oApiUsersManager = CApi::Manager('users');
    $oAccount = $oApiUsersManager->getAccountByEmail("username@domain.com");
    $oApiContactsManager = CApi::Manager('contacts');
	$counter = 0;
    $oApiContactsManager->import($oAccount->IdUser,"csv","./sample.csv", $counter, 0, 0);
} else {
    echo 'AfterLogic API isn\'t available';
}

NOTE: many methods of this API manager return boolean values. If not stated otherwise, bool value true/false stands for success or failure respectively.

API reference on CApiContactsManager class