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 in the forums, please register and review our posting policy & tips. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack (1) Thread Tools Display Modes
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 10-25-2007, 06:55 AM
Member
 
Posts: 13
Default Perl Module to simplify SOAP access to Zimbra

******* If you downloaded a copy of ZimbraSession.pm and it's not working ******* It's because I uploaded a broken copy. Please re-download the file
******* It should be working fine now. Sorry.

Hey all, I don't know if something already exist like this but I wrote a simple Perl module to simplify SOAP communications with the Zimbra server. Basically I just took some of the existing Perl scripts and converted them into methods, and put them in one module. Hopefully this can be of some use to someone. If some one knows of a better module please let me know. Or if you upgrade and make this one better please let me know. I will attach the module, and the crappy example file I made. Below is the example file so you can see how it's used. All the methods are really only for dealing with the Calendar because that's all I need it for. Hopefully someone will add to it and covert the scripts for email's to methods for this module.

This is how to use the module:

#!/usr/bin/perl -w

use lib '/usr/local/src/Zimbra/'; # Holds Soap.pm, Soap11, Soap12 Sudds.., XmlDoc, XmlElement, and ZimbraSession

use ZimbraSession;

################################################## ############
#
# All these methods return the SOAP response from the server.
#
################################################## ############

##############################
# Create New Appointment
##############################

# As an option you can set acctns and mailns. By default they are set to urn:zimbraAccount and urn:zimbraMail respectively.

my $zs = ZimbraSession->new(
{name => 'Display Name', login => 'username'},
'password',
'http://yourhost.net/service/soap/',
# {acctns => '', mailns => ''}
);

my $attendees = [
{name => 'Matt Foley', email => 'mfoley@email.com'},
{name => 'Bill Brasky', email => 'bbrasky@email.com'}
]; # List of attendees to invite to an appointment


# For now this will only set an appointment in your default Calendar.
# These are not recurring appointmetns like the createAppt.pl script

my $appointment = $zs->createAppt(
'Subject', 'Location',
'', # Show as
'', # Calendar
'Start Time',
'End Time',
'', # Recuring
$attendees,
'Plain Text Message',
"HTML Message",
''
);

#####################
# Cancel Appointment
#####################

my $cancel_appointment = $zs->cancelAppt($invId, $subject, $message, $attendees);

###########################
# Retrieve an Appointment
###########################

my $appointment = $zs->getAppt($apptId);

##################################
# Retrieve Appointment Summaries
##################################

my $summaries = $zs->getApptSummaries($start_time, $end_time);

##################################
# Modify an Appointment
##################################

my $modified_appt = $zs->modifyAppt(
$invId, $mode, $end_time,
$subject, $message, $location,
$current_attendees, $new_attendees
);

##################################
# Create Folder
##################################
# Right now I believe this only creates Calendars, because that's all I needed, but it can easily be modifed to
# create folders. You just need to figure out the correct 'view' and edit it the method.

my $folder = $zs->createFolder($folder_name);

##################################
# Delete Folder
##################################

# I dont think you can use the folder name here.
# The folder id is returned in the respone from createFolder();

my $deleted_folder = $zs->deleteFolder($folder_id);
Attached Files
File Type: txt ZimbraSessionExample.txt (3.3 KB, 325 views)
File Type: txt ZimbraSession.pm.txt (11.3 KB, 538 views)

Last edited by crankin : 10-25-2007 at 07:47 AM. Reason: I uploaded the wrong version of ZimbraSession.pm
Reply With Quote
  #2 (permalink)  
Old 10-25-2007, 09:49 AM
Zimlet Guru
 
Posts: 387
Default

Cool stuff. I am stickying this for right now, but could you also add this information to the Zimbra Wiki?
Reply With Quote
  #3 (permalink)  
Old 10-25-2007, 10:21 AM
Zimbra Employee
 
Posts: 5,606
Default

Nice.
Crankin- can you PM me your shipping info and I'll send you out a shirt.

jh
Reply With Quote
  #4 (permalink)  
Old 10-25-2007, 01:51 PM
Member
 
Posts: 13
Default

Quote:
Originally Posted by JoshuaPrismon View Post
Cool stuff. I am stickying this for right now, but could you also add this information to the Zimbra Wiki?
Yes, I will upload it to the Wiki.
Reply With Quote
  #5 (permalink)  
Old 10-25-2007, 03:33 PM
Member
 
Posts: 13
Default

Wiki is up.

EDIT (mmorse):
Login and manipulate Zimbra account with Perl - Zimbra :: Wiki

Last edited by mmorse : 07-03-2008 at 12:08 PM.
Reply With Quote
  #6 (permalink)  
Old 06-11-2009, 09:30 AM
Starter Member
 
Posts: 1
Default ZimbraSession Extensions

Great module. Thanks.

At Eastern Michigan University we needed a way to migrate course calendars.
So, I made a few changes specific to our needs (namely, support for shared calendars and recurring appointments).

I figured I'd post the code as a continuation to this thread. I can't guarantee the code will work for everyone, but it works very well for us.
Attached Files
File Type: txt ZimbraSession.pm.txt (11.6 KB, 22 views)
File Type: txt testcreatecal.pl.txt (5.5 KB, 20 views)
Reply With Quote
Reply


Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't start Zimbra! zibra Administrators 5 03-22-2007 11:34 AM
dspam logrotate errors michaeln Users 7 02-19-2007 11:45 AM
zimbra-core missing kinaole Developers 1 10-02-2006 11:59 AM
Installation succesfful! But problem with zmcontrol start mansuper Installation 16 09-07-2006 06:39 AM
port 7071 not listening OS X install rm* Installation 7 03-21-2006 09:47 AM

Why Join?

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

Zimbrablog.com

sourceforge.net



 

Search Engine Optimization by vBSEO 3.1.0