Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 10-25-2007, 06:55 AM
crankin crankin is offline
Member
 
Join Date: Apr 2007
Posts: 13
crankin is on a distinguished road
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, 76 views)
File Type: txt ZimbraSession.pm.txt (11.3 KB, 116 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
JoshuaPrismon JoshuaPrismon is offline
Moderator
 
Join Date: Nov 2005
ZCS Version: Release 5.0.0_BETA2_1092.FC5_20070718124259 FC5_64 FOSS edition
Posts: 380
JoshuaPrismon is on a distinguished road
Send a message via AIM to JoshuaPrismon
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
jholder's Avatar
jholder jholder is offline
Zimbra Employee
 
Join Date: Oct 2005
Location: San Mateo, CA
ZCS Version: 5.0.5 RHEL4 64-bit GA
Posts: 5,425
jholder is on a distinguished road
Send a message via Yahoo to jholder
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
crankin crankin is offline
Member
 
Join Date: Apr 2007
Posts: 13
crankin is on a distinguished road
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
crankin crankin is offline
Member
 
Join Date: Apr 2007
Posts: 13
crankin is on a distinguished road
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
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

LinkBacks (?)
LinkBack to this Thread: http://www.zimbra.com/forums/developers/12382-perl-module-simplify-soap-access-zimbra.html
Posted By For Type Date
Zimbra™ Collaboration Suite - SWiK This thread Refback 11-08-2007 08:00 AM

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


freshmeat.net sourceforge.net The best Java IDE



 

Search Engine Optimization by vBSEO 3.0.0