Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Developers

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.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-19-2011, 05:40 AM
Junior Member
 
Posts: 6
Default Get appointment of shared calendar

Hi !

I use the excellent module "Zimbra Calendar" for Joomla by Richard Gate.

It works great, but I want to add one little function :

For now, the module list the day appointment, for the Default calendar only.

So, I go see the code (helper.php), I see "inid:10" and I think it's the id of the Default Calendar :


PHP Code:
 //Get today's appointments
 
function zimbra_get_appts_today($calsort)
 {
  
$datestart mktime(0,0,0);
  
$dateend $datestart + (24 60 60) - 1;
  
$sortby "dateDesc";
  if (
$calsort == '1'$sortby "dateAsc";
  
$req =
  
'<SearchRequest xmlns="urn:zimbraMail" types="appointment" calExpandInstStart="'.$datestart.'000" calExpandInstEnd="'.$dateend.'000" limit="10" sortBy="'.$sortby.'">
   <query> inid:526 </query>
   </SearchRequest>'
;
  
$this->zimbraSOAP_build_request($req);
  if (!(
$res $this->zimbraSOAP_execute_request())) return false;
  if (!isset(
$res['SOAP:ENVELOPE']['SOAP:BODY']['SEARCHRESPONSE'])) return false;
  return 
$res['SOAP:ENVELOPE']['SOAP:BODY']['SEARCHRESPONSE'];
 } 

So, I try to change the id in the request, for example "inid:526" for the Calendar name "Others".

But, it doesn't work with the id of shared calendar.

How I can change the request to list all day events of all calendar, including shared calendar ?

It will be even better if we can list that only for the calendar checked in Zimbra tree List.

Thanks a lot
Reply With Quote
  #2 (permalink)  
Old 04-19-2011, 05:43 PM
Intermediate Member
 
Posts: 17
Default

We are doing similar thing, getting other user's calendar. I believe the same will work for user's own calendars. We get ID for those calendars (those are folders/links) using GetFolderRequest. Perhaps you can find what you need with this request, and set inid:VALUE with VALUE with value in folder's attribute "id".

Let me know if you want example of this (I have example SOAP requests and responses).
Reply With Quote
  #3 (permalink)  
Old 05-04-2011, 07:37 AM
Junior Member
 
Posts: 6
Default

Yes, to display one specific calendar, I used the line :

Inid:10

10 is the id of default calendar, so I put the id I want.
And to display all calendar, i have just to replace the inid Line by :

Item:all

It works great, except for shared calendar :/ Grrrr

The only problem is that don't display these shared calendar, and I already checked in soap api and forum, I don't find anything...

The best solution would be to display all appointment of the calendar who are selected (checked) in Zimbra left tree
Reply With Quote
  #4 (permalink)  
Old 05-04-2011, 11:32 AM
Intermediate Member
 
Posts: 17
Default

Dear jujusous3,

Something small (just in case): please confirm appt-start and appt-end are correct to ensure catching some appointments. The time you see appointments on your calendar will be correct using the time zone, but these parameters use number of milliseconds since January 1, 1970, 00:00:00 GMT.

Note if you put app-start > appt-end, the response will look fine, with no data, since no appointment can start after it finishes.

Talking about tree on browser, it sounds like you may be using REST. We are using SOAP; believe both SOAP and REST should work fine.

What version of Zimbra are you using? Our examples are on Zimbra v6.0.8.

It would help if you could show the requests and responses being made (SOAP or JSON would work); Wireshark should be able to catch those for you.

Here is how we successfully get appointments from a shared calendar.

Calendar "Rescal's Test1" was shared, giving advisor-admin role "Admin", and with "Allow user(s) to see my private appointments" checked.

1. Login as advisor-admin
2. Get advisor-admin's folders (and links):
<zmail:GetFolderRequest>
3. Get ID for link "Rescal's Test1" from response to step 2
- name="Rescal's Test1" id="300"
4. Make request for appointments.

Here is part of the response, including the shared calendar Friend needs access to.

Response for step 2:
Code:
        <GetFolderResponse xmlns="urn:zimbraMail">
            <folder i4ms="1" i4next="2" id="1" l="11" ms="1" n="0" name="USER_ROOT" rev="1" s="0">
                <link color="1" f="#" id="300" l="1" ms="10775" name="Rescal's Test1" owner="rescal@carmen.egr.msu.edu" rev="10775" rgb="#5B9BF2" rid="257" view="appointment" zid="a1dcec46-6ef4-444d-b13c-5547d58b0860"/>
                <link color="1" id="262" l="1" ms="10780" name="User One's Calendar" owner="user1@carmen.egr.msu.edu" rev="13" rgb="#5B9BF2" rid="10" view="appointment" zid="e583b35d-c01d-49cd-85eb-d98380d7ca48"/>
            </folder>
        </GetFolderResponse>
When we make SearchRequest with inid:300, it returns appointments for "Rescal's Test1".

Request for step 4:
Code:
	<soap:Body>
		<zmail:SearchRequest
				types="appointment">
			<query>
				inid:300
				AND appt-start:&lt;=1304618943139
				AND appt-end:&gt;=1304446143139
			</query>
		</zmail:SearchRequest>
	</soap:Body>
Response for step 4:
Code:
	<soap:Body>
        <SearchResponse xmlns="urn:zimbraMail" more="0" offset="0" sortBy="dateDesc">
            <appt alarm="1" class="PUB" cm="1" compNum="0" d="1304529598000" dur="1800000" f="" fb="B" fba="B" id="a1dcec46-6ef4-444d-b13c-5547d58b0860:264" invId="a1dcec46-6ef4-444d-b13c-5547d58b0860:264-263" isOrg="1" l="a1dcec46-6ef4-444d-b13c-5547d58b0860:257" loc="" md="1304529598" ms="12" name="Test event" ptst="AC" rev="12" s="0" score="1.0" sf="1304529598000" status="CONF" t="" transp="O" uid="eadd1337-c9cb-464b-8f3f-e8b2a372e3f0" x_uid="eadd1337-c9cb-464b-8f3f-e8b2a372e3f0">
                <or a="rescal@carmen.egr.msu.edu" d="Resource Calendar" url="rescal@carmen.egr.msu.edu"/>
            </appt>
        </SearchResponse>
    </soap:Body>
Reply With Quote
  #5 (permalink)  
Old 03-27-2012, 01:19 AM
Active Member
 
Posts: 37
Default

Is it possible to add appointments from Joomla in Zimbra Calendar?
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.