Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Method createAccount #43

Open
maksymkornilenko opened this issue Apr 22, 2020 · 4 comments
Open

Method createAccount #43

maksymkornilenko opened this issue Apr 22, 2020 · 4 comments

Comments

@maksymkornilenko
Copy link

I need help. I want to set third params to attr givenName, displayName and cn How I can do that

@subhankar
Copy link

Hi I am also need same help how to set different parameters in createAccount() method. I tried to pass as parameters but no luck.

// $accountPramas = array(
// 'givenName'=>'John',
// 'sn'=>'Doe',
// 'displayName'=>'John Doe'
// );

$api->createAccount($account_name,$password,$accountPramas);

@antonioneris
Copy link

Hi a have same problem.

code

$username = 'antonio';
$domain = 'test.test';
$pass = 'pass';
$data = [
    'displayName' => 'Antonio Jr',
    'co' => 'Brasil',
    'l' => 'Sao Jose do Rio Preto',
    'mobile' => 'xx xxxxxxx',
    'postalCode' => 'xxxxxx',
    'st' => 'xx',
    'telephoneNumber' => 'xxxxxx',
    'title' => 'Analista de Sistemas'
];
$adminApi = \Zimbra\Admin\AdminFactory::instance('https://mail.xxxxxxxxxxxxx.com.br:7071/service/admin/soap');   
$adminApi->auth ( 'admin', 'pass'); 
$adminApi->createAccount($username.'@'.$domain, $pass, $data);

Error

UnexpectedValueException
TypedSequence<Zimbra\Struct\KeyValuePair> can only hold objects of Zimbra\Struct\KeyValuePair class.

@maksymkornilenko
Copy link
Author

Hi a have same problem.

code

$username = 'antonio';
$domain = 'test.test';
$pass = 'pass';
$data = [
    'displayName' => 'Antonio Jr',
    'co' => 'Brasil',
    'l' => 'Sao Jose do Rio Preto',
    'mobile' => 'xx xxxxxxx',
    'postalCode' => 'xxxxxx',
    'st' => 'xx',
    'telephoneNumber' => 'xxxxxx',
    'title' => 'Analista de Sistemas'
];
$adminApi = \Zimbra\Admin\AdminFactory::instance('https://mail.xxxxxxxxxxxxx.com.br:7071/service/admin/soap');   
$adminApi->auth ( 'admin', 'pass'); 
$adminApi->createAccount($username.'@'.$domain, $pass, $data);

Error

UnexpectedValueException
TypedSequence<Zimbra\Struct\KeyValuePair> can only hold objects of Zimbra\Struct\KeyValuePair class.

You need to use class KeyValuePair.
For example:
$attrGivenName = new KeyValuePair ('givenName', $firstName);
$attrDisplayName = new KeyValuePair ('givenName', $firstName.' '.$lastName);
$api->createAccount($mailLogin, $mailPass,[$attrGivenName,$attrDisplayName]);

@antonioneris
Copy link

Hi a have same problem.
code

$username = 'antonio';
$domain = 'test.test';
$pass = 'pass';
$data = [
    'displayName' => 'Antonio Jr',
    'co' => 'Brasil',
    'l' => 'Sao Jose do Rio Preto',
    'mobile' => 'xx xxxxxxx',
    'postalCode' => 'xxxxxx',
    'st' => 'xx',
    'telephoneNumber' => 'xxxxxx',
    'title' => 'Analista de Sistemas'
];
$adminApi = \Zimbra\Admin\AdminFactory::instance('https://mail.xxxxxxxxxxxxx.com.br:7071/service/admin/soap');   
$adminApi->auth ( 'admin', 'pass'); 
$adminApi->createAccount($username.'@'.$domain, $pass, $data);

Error
UnexpectedValueException
TypedSequence<Zimbra\Struct\KeyValuePair> can only hold objects of Zimbra\Struct\KeyValuePair class.

You need to use class KeyValuePair.
For example:
$attrGivenName = new KeyValuePair ('givenName', $firstName);
$attrDisplayName = new KeyValuePair ('givenName', $firstName.' '.$lastName);
$api->createAccount($mailLogin, $mailPass,[$attrGivenName,$attrDisplayName]);

Thanks for you help, everything worked out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants