| Welcome to the Zimbra :: Forums! | |
Welcome, if you would like to post a comment please register.
We also encourage you to explore all things Zimbra with our team and members of the community.
|  | | 
10-31-2008, 08:11 AM
| | Project Contributor | |
Posts: 14
| | Acces to quotas information through SOAP hello,
i'm in the way of creation a php interface to zimbra.
I user this class: [SOLVED] PHP Class for easy access to Zimbra SOAP API
First i really don't know how to see the space that used for user, in the admin interface or with soap request...
Second when i apply a quota of 150Mb of a user, when i get result in soap or ldap the result is zimbraMailQuota = 157286400 ...so 157MB do you know why ?
thanks,
Syruis. | 
10-31-2008, 08:28 AM
| | Project Contributor | |
Posts: 14
| | For the problème with 150&157, i have see the problem it since the size of a space disk is 1Mo = 1024 o..
But I don't know where i can see the size of a emailbox...
Rgds, | 
10-31-2008, 09:58 AM
| | | He does have it included in the php class - zimbraAdmin.php: Code: <GetQuotaUsageRequest xmlns="urn:zimbraAdmin"';
if ($limit != 0)
$soapmessage .= ' limit=\"$limit\"';
if ($offset != 0)
$soapmessage .= ' offset=\"$offset\"';
if ($domain != "")
$soapmessage .= ' domain=\"$domain\"';
if ($sort != "")
$soapmessage .= ' sortBy=\"$sort\"';
if ($sortAsc != "")
$soapmessage .= ' sortAscending=\"$sortAsc\"';
$soapmessage .= '>
</GetQuotaUsageRequest> soap-admin.txt Code: <GetQuotaUsageRequest [limit="..."] [offset="..."] [domain="{limit-to-domain}"]
[sortBy="{sort-by}"] [sortAscending="{sort-ascending}"]]>
</GetQuotaUsageRequest>
<GetQuotaUsageResponse more="{more-flag}" [searchTotal="{search-total}"]>
<account name="{name}" id="{id}" used="quota-used" limit="quota-limit"/>+
</GetQuotaUsageResponse>
Notes:
GetQuotaUsageRequest
limit - the number of accounts to return (0 is default and means all)
offset - the starting offset (0, 25, etc)
domain - the domain name to limit the search to
sortBy - valid values: "percentUsed", "totalUsed", "quotaLimit"
sortAscending - whether to sort in ascending order (0/1), 0 is default, so highest quotas are returned first
more-flag = true if more accounts left to return
search-total = total number of accounts that matched search (not affected by limit/offset)
used = used quota in bytes, or 0 if no quota used
limit = quota limit in bytes, or 0 if unlimited
The target server should be specified in the soap header (see soap.txt, <targetServer>).
When sorting by "quotaLimit", 0 is treated as the highest value possible. Admin console:
Server Statistics > Server > Mailbox Quota tab
CLI:
zmprov GetQuotaUsage localhost
Spits it out in bytes- second column is max quota (0=unlimited) third column will be used amount
Could do something like:
zmprov gqu `zmhostname` | awk {'print " "$3" "$2" "$1'} | 
11-03-2008, 12:18 AM
| | Project Contributor | |
Posts: 14
| | Quote:
Originally Posted by mmorse He does have it included in the php class - zimbraAdmin.php: Code: <GetQuotaUsageRequest xmlns="urn:zimbraAdmin"';
if ($limit != 0)
$soapmessage .= ' limit=\"$limit\"';
if ($offset != 0)
$soapmessage .= ' offset=\"$offset\"';
if ($domain != "")
$soapmessage .= ' domain=\"$domain\"';
if ($sort != "")
$soapmessage .= ' sortBy=\"$sort\"';
if ($sortAsc != "")
$soapmessage .= ' sortAscending=\"$sortAsc\"';
$soapmessage .= '>
</GetQuotaUsageRequest> soap-admin.txt Code: <GetQuotaUsageRequest [limit="..."] [offset="..."] [domain="{limit-to-domain}"]
[sortBy="{sort-by}"] [sortAscending="{sort-ascending}"]]>
</GetQuotaUsageRequest>
<GetQuotaUsageResponse more="{more-flag}" [searchTotal="{search-total}"]>
<account name="{name}" id="{id}" used="quota-used" limit="quota-limit"/>+
</GetQuotaUsageResponse>
Notes:
GetQuotaUsageRequest
limit - the number of accounts to return (0 is default and means all)
offset - the starting offset (0, 25, etc)
domain - the domain name to limit the search to
sortBy - valid values: "percentUsed", "totalUsed", "quotaLimit"
sortAscending - whether to sort in ascending order (0/1), 0 is default, so highest quotas are returned first
more-flag = true if more accounts left to return
search-total = total number of accounts that matched search (not affected by limit/offset)
used = used quota in bytes, or 0 if no quota used
limit = quota limit in bytes, or 0 if unlimited
The target server should be specified in the soap header (see soap.txt, <targetServer>).
When sorting by "quotaLimit", 0 is treated as the highest value possible. Admin console:
Server Statistics > Server > Mailbox Quota tab
CLI:
zmprov GetQuotaUsage localhost
Spits it out in bytes- second column is max quota (0=unlimited) third column will be used amount
Could do something like:
zmprov gqu `zmhostname` | awk {'print " "$3" "$2" "$1'} | I have see. But it's really doesn't work. the function "zimbra_get_cos" "zimbra_get_current_volumes" is bug too.
I have modify many "function"... like "zimbra_search_gal" but for this one, i haven"t show where is the problem.
Syruis.
Last edited by Syruis; 11-03-2008 at 12:22 AM..
| 
11-03-2008, 12:44 AM
| | | I renamed the thread, in order to show the real problem (SOAP and quota). | 
11-03-2008, 12:45 AM
| | Project Contributor | |
Posts: 14
| | Example1:
"zimbra_get_cos" always return:
3128soap:Senderno such cos: test@test.fraccount.NO_SUCH_COSbtpool0-9:1225702223229:a64b3cc9eef60d95 | 
11-03-2008, 12:45 AM
| | Project Contributor | |
Posts: 14
| | Quote:
Originally Posted by Klug I renamed the thread, in order to show the real problem (SOAP and quota). | Ok thanks... | 
11-03-2008, 01:20 AM
| | Project Contributor | |
Posts: 14
| | Quote:
Originally Posted by Syruis Example1:
"zimbra_get_cos" always return:
3128soap:Senderno such cos: test@test.fraccount.NO_SUCH_COSbtpool0-9:1225702223229:a64b3cc9eef60d95 | zimbra_get_quota_usage(0,0,"testdomain.com","","") ; =>
soap:Senderparse error: Error on line 11 of document : Open quote is expected for attribute "domain" associated with an element type "GetQuotaUsageRequest". Nested exception: Open quote is expected for attribute "domain" associated with an element type "GetQuotaUsageRequest".service.PARSE_ERRORbtpo ol0-9:1225703586774:a64b3cc9eef60d9
So i do:
// if ($domain != "")
// $soapmessage .= ' domain=\"'.$domain.'\"';
And it return "3132" ... "3133" ... "3134" .. etc ( and it have no signification for me ) does anyone knows why?
..
Excuse my poor English it's not my matern language...
Last edited by Syruis; 11-03-2008 at 01:57 AM..
| 
11-04-2008, 03:13 AM
| | Project Contributor | |
Posts: 14
| | Solution.. for get a quota for a mail Call: Code: $val=$zim->zimbra_get_quota_usage($limit = 0, $offset = 0,$domain, $sort = "", $sortAsc = "");//retourne tous les quota du domaine
if (!$val)//DEBUG
return array(0 => 'return false xml error');
$taille = sizeof($val['ACCOUNT']);$i=0;
while($i != $taille){
if (trim($val['ACCOUNT'][$i]['NAME']) == trim($email))
return $val['ACCOUNT'][$i];
$i++;
}
return array(0 => 'return false no account for this email ('.$email.')'); And modification in ZimbraAdmin.php Code: function zimbra_get_quota_usage($limit = 0, $offset = 0, $domain = "", $sort = "", $sortAsc = "") {
$xml = new xml2Array();
$this->set_zimbra_header();
$soapmessage = $this->soapheader . '
<GetQuotaUsageRequest xmlns="urn:zimbraAdmin"';
if ($limit != 0)
$soapmessage .= ' limit=\"'.$limit.'\"';
if ($offset != 0)
$soapmessage .= ' offset=\"$offset\"';
// if ($domain != "")
$soapmessage .= ' domain="'.$domain.'"';
if ($sort != "")
$soapmessage .= ' sortBy=\"$sort\"';
if ($sortAsc != "")
$soapmessage .= ' sortAscending=\"$sortAsc\"';
$soapmessage .= '>' .
'
</GetQuotaUsageRequest>
</soap:Body>
</soap:Envelope>';
curl_setopt($this->curlhandle, CURLOPT_POSTFIELDS, $soapmessage);
if (!($zimbraSOAPResponse = curl_exec($this->curlhandle))) {
$this->zimbraerrno = curl_errno($this->curlhandle);
$this->zimbraerror = curl_error($this->curlhandle);
return false;
}
$res = $xml->parse($zimbraSOAPResponse);
if (isset ($res['SOAP:ENVELOPE']['SOAP:BODY']['GETQUOTAUSAGERESPONSE']))
return $res['SOAP:ENVELOPE']['SOAP:BODY']['GETQUOTAUSAGERESPONSE'];
return false;
} Thanks for all,
regards | 
10-22-2009, 05:34 PM
| | | new xml2Array() can you post the code for this one  | | Thread Tools | Search this Thread | | | | | Display Modes | Linear Mode | | Why Join? Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.  |