zimbra-api / soap-api

Zimbra SOAP client in PHP language
BSD 3-Clause "New" or "Revised" License
63 stars 50 forks source link

Modify Account COS #63

Open keichitokuna opened 1 week ago

keichitokuna commented 1 week ago

Hello,

I am attempting to create a Zimbra account using this API, but I'm encountering some issues.

The environment I'm working with is a bit outdated:

- Symfony 5.4
- SOAP API v2.2 (your library)
- Zimbra API 8.8.15

Here’s the code I’m using:

$attrs[0] = new KeyValuePair('zimbraCOSId', $zimbraCosId);
try {
    $api->createAccount($mail, $password, $attrs);
    $this->logger->info("$mail created in Zimbra");
} catch (\Exception $e) {
    $this->logger->error($e->getMessage());
}

However, it seems like this no longer works, as it appears the zimbraCOSId is no longer an attribute. Here’s the response I get:

Zimbra\Admin\Message\GetAccountInfoResponse {#1155 ▼  
 -requestId: null  
 -name: "test.dupont@domain.fr"
  -attrList: array:2 [▼  
    0 => Zimbra\Admin\Struct\Attr {#1169 ▶}
    1 => Zimbra\Admin\Struct\Attr {#1152 ▶}
  ]
  -cos: Zimbra\Admin\Struct\CosInfo {#1252 ▼    
    -name: "personnel"
    -id: "7fda1c53-6ed2-4423-a12f-2eb57cb71983"
    -isDefaultCos: null
    -attrs: []
  }
  -soapURLList: array:2 [▼  
    0 => "http://zs1.domain.fr:80/service/soap/"
    1 => "https://zs1.domain.fr:443/service/soap/"
  ]
  -adminSoapURL: "https://zs1.domain.fr:7071/service/admin/soap/"
  -publicMailURL: "https://webmail.domain.fr"
}

It seems the COS is now a separate object (cos), and I’ve tried several approaches to set the COS for the account but without success.

Could you please assist me in resolving this? Is there a different way to assign a COS during account creation in this setup?

Thanks in advance for your help!

K.