Page 1 of 2 12 LastLast
Results 1 to 10 of 23

Thread: Perl Module to simplify SOAP access to Zimbra

Hybrid View

  1. #1
    Join Date
    Apr 2007
    Posts
    13
    Rep Power
    8

    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 Attached Files
    Last edited by crankin; 10-25-2007 at 08:47 AM. Reason: I uploaded the wrong version of ZimbraSession.pm

  2. #2
    Join Date
    Nov 2005
    Posts
    477
    Rep Power
    10

    Default

    Cool stuff. I am stickying this for right now, but could you also add this information to the Zimbra Wiki?

  3. #3
    Join Date
    Oct 2005
    Location
    Thatcher, AZ
    Posts
    5,606
    Rep Power
    21

    Default

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

    jh

  4. #4
    Join Date
    Apr 2007
    Posts
    13
    Rep Power
    8

    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.

  5. #5
    Join Date
    Apr 2007
    Posts
    13
    Rep Power
    8

    Default

    Last edited by mmorse; 07-03-2008 at 01:08 PM.

  6. #6
    Join Date
    Jun 2009
    Posts
    3
    Rep Power
    6

    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 Attached Files

  7. #7
    Join Date
    Apr 2010
    Posts
    6
    Rep Power
    5

    Default

    Don't work!!
    I try both class but doesn't work!!
    The AuthResponse dont has the sessionid!!

  8. #8
    Join Date
    Jun 2009
    Posts
    3
    Rep Power
    6

    Default Session Id is not used

    If you look carefully, you'll see that session id is not actually used in the code and was removed in one of the point releases of Zimbra (I can't remember which). Just comment out or remove lines in the code that get the session id out of the AuthResponse.

  9. #9
    Join Date
    Jun 2009
    Posts
    3
    Rep Power
    6

    Default Updated Code

    Anyway, try this. It has my most recent changes.
    Attached Files Attached Files

  10. #10
    Join Date
    Apr 2010
    Posts
    6
    Rep Power
    5

    Default

    Thankyou so much!!
    It realy works!!

Similar Threads

  1. Can't start Zimbra!
    By zibra in forum Administrators
    Replies: 5
    Last Post: 03-22-2007, 12:34 PM
  2. dspam logrotate errors
    By michaeln in forum Users
    Replies: 7
    Last Post: 02-19-2007, 12:45 PM
  3. zimbra-core missing
    By kinaole in forum Developers
    Replies: 1
    Last Post: 10-02-2006, 12:59 PM
  4. Replies: 16
    Last Post: 09-07-2006, 07:39 AM
  5. port 7071 not listening OS X install
    By leeimber in forum Installation
    Replies: 7
    Last Post: 03-21-2006, 10:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •