GetAppointment by uid using SOAP API

Have a great idea for extending Zimbra? Share ideas, ask questions, contribute, and get feedback.
catone.cremonesi
Posts: 1
Joined: Thu Feb 23, 2017 9:42 am

GetAppointment by uid using SOAP API

Postby catone.cremonesi » Thu Feb 23, 2017 10:26 am

Hello all,

I'm trying to fetch an appointment by uid using the SOAP API.

Here's a SSCCE using the php wrapper ( https://github.com/zimbra-api/zimbra-api ):

Code: Select all

<?php

require 'vendor/autoload.php';

use Zimbra\Enum\AccountBy;
use Zimbra\Mail\MailFactory;
use Zimbra\Struct\AccountSelector;

$api = MailFactory::instance('https://... my zimbra server ...');
try {
    $account = new AccountSelector(AccountBy::NAME(), '... my user name ...');
    $api->auth($account, '...  my password ..');

    $result = $api->getAppointment(null, null, null, '8705c923-0281-4cf7-80b9-3a4fa37f93ee', null);
    var_dump($result);
}
catch(Exception $ex) {
    $client = $api->getClient();
    echo $client->lastResponse();
}


When the uid refers to an appointment contained in a local calendar the code works correctly, when the uid refers to an appointment in a shared calendar (not owned by the account that performs the request) I get the following error:

Code: Select all

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
    <soap:Header>
        <context xmlns="urn:zimbra"><change token="1902"/></context>
    </soap:Header>
    <soap:Body>
        <soap:Fault>
            <soap:Code>
                <soap:Value>soap:Sender</soap:Value>
            </soap:Code>
            <soap:Reason>
                <soap:Text>no such appointment or task: 8705c923-0281-4cf7-80b9-3a4fa37f93ee</soap:Text>
            </soap:Reason>
            <soap:Detail>
                <Error xmlns="urn:zimbra">
                    <Code>mail.NO_SUCH_CALITEM</Code>
                    <Trace>qtp1937601231-845243:https://... my zimbra server ... /service/soap:1487843590290:9167a921c22538c7</Trace>
                    <a t="STR" n="uid">8705c923-0281-4cf7-80b9-3a4fa37f93ee</a>
                </Error>
            </soap:Detail>
        </soap:Fault>
    </soap:Body>
</soap:Envelope>


It's working as it should or am I missing something?

I need some kind of id to fetch a specific appointment using the GetAppointment method, the id can't change in time and I need to use the same id to fetch the appointment from different zimbra accounts who share calendars with each others.

Thank you


shrikant-prasad
Posts: 6
Joined: Fri Jun 09, 2017 4:57 am

Re: GetAppointment by uid using SOAP API

Postby shrikant-prasad » Fri Jun 09, 2017 9:28 am

uid is present in metadata of the appointment created in owner's mailbox and it's not present in metadata of the appointment in other user's mailbox with whom calendar has been shared. That's why search with uid works for items in local folder and doesn't for shared folder.
You should use "id" instead of uid to get appointments in shared folder.
id format would be "<accountIdOfOwner>:<itemIdInOwnerMailbox>"

when id is used the request will get proxied to the owner mailbox for appointment search and result would be returned.

Return to “Developers”

Who is online

Users browsing this forum: No registered users and 4 guests