Results 1 to 6 of 6

Thread: Creating an Appointment Request with SOAP

  1. #1
    Join Date
    Sep 2006
    Location
    Illinois
    Posts
    374
    Rep Power
    9

    Default Creating an Appointment Request with SOAP

    Hi,

    We've got some Ruby code that is creating appointments in a calendar and it works great. What we're trying to do now is add the necessary SOAP to the code so that it will also create and send the appointment request to attendees. This does not seem to work though. The appointment gets created in the owners calendar but no invitation request is delivered to the attendees.

    Has anyone else done any SOAP stuff and gotten this to work? Here's a code snippet...

    Thanks,
    Matt

    Code:
      def self.createappointment(host, authToken, start, subject, user, advisor, description='')
        finish = start+30.minutes
        user_obj = User.find_by_ecom(user)
        advisor_obj = LdapUser.find(advisor)
        
        #Send request to student
        header = SOAP::SOAPHeader.new
        context = element('context', nil, {'xmlns' => 'urn:zimbra'}, [
          element('authToken', authToken)
        ])
        header.add('context', context)
        body = SOAP::SOAPBody.new(element('CreateAppointmentRequest', nil,
          {
            'xmlns' => 'urn:zimbraMail'
          },
          [
            element('m', nil, {}, [
              [element('e', user.mail, {}, [])],
              element('inv', nil, {}, [
                element('comp', nil,
                  {
                    'status' => 'CONF',
                    'fba' => 'B',
                    'allDay' => false,
                    'name' => subject,
                    'loc' => advisor_obj.buildingName + ' room ' + advisor_obj.roomNumber,
                    'noBlob' => 1,
                    'e' => user,
                  },
                  [
                    datetime('s', start),
                    datetime('e', finish),
                    element('or', nil,
                      {
                        'a' => advisor_obj.uid,
                        'd' => advisor_obj.uid
                      }
                    ),
                    element('at', nil,
                      {
                        'a' => user_obj.mail,
                        'd' => user_obj.name,
                        'ptst' => 'NE',
                        'role' => 'REQ',
                        'sentBy' => advisor_obj.uid,
                        'cutype' => 'IND',
                        'rsvp' => '1',
                      }
                    ),
                    element('desc', description),
                  ]
                ),
              ]),
            ]),
          ]
        ))
        envelope = SOAP::SOAPEnvelope.new(header, body)
        send_soap(envelope, host)
      end

  2. #2
    Join Date
    Jan 2010
    Posts
    138
    Rep Power
    5

    Default

    The element('e', user.mail, {}, []) part should have taken care of sending requests to attendees. Make sure that the soap request created by your code has this element with the correct value.

  3. #3
    Join Date
    May 2014
    Posts
    3
    Rep Power
    1

    Default

    I'm tryng to made it with php and set the fiellds in xml.
    In the api reference i found this section:
    (<e [a="{email-address}"] [d="{display-name}"] [p="{personal name}"] [t="{address-type}"]
    [isGroup="{email-addr-is-group} (0|1)"] [exp="{can-expand-group-members} (0|1)"] /> ## EmailInfo)*
    but I don't get the documentation for address-type...
    could you make me a working example of how to fill this section?
    Thanks in advance...

  4. #4
    Join Date
    Oct 2009
    Location
    Dublin, IRELAND
    Posts
    712
    Rep Power
    7

    Default

    The following definitions are in soap.txt
    Email addresses:

    <e [t="{type}"] p="{personal-name}" a="{email-address}" d="{display-name}">{content}</e>

    {type} = (f)rom, (t)o, (c)c, (b)cc, (r)eply-to, (s)ender, read-receipt (n)otification

    Type is only sent when an individual message is returned. In the
    list of conversations, all the email addresseses returned for a conversation are a subset
    of the participants. In the list of messages in a converstation, the email addressses are
    the senders.

    {personal-name} = the comment/name part of an address
    {email-address} = the user@domain part of an address
    {display-name} = if we have personal, first word in "word1 word2" format, or last word in "word1, word2" format.
    if no personal, take string before "@" in email-address.
    {content} = the original email string as specified by the sender (since we can't reliably reconstruct it
    out of the components)

  5. #5
    Join Date
    May 2014
    Posts
    3
    Rep Power
    1

    Default

    Quote Originally Posted by liverpoolfcfan View Post
    The following definitions are in soap.txt
    Thank you, but still I have a problem!
    In the {type} section
    {type} = (f)rom, (t)o, (c)c, (b)cc, (r)eply-to, (s)ender, read-receipt (n)otification
    I need to write a string. But I don't know how to skip element I don't need and I don't know to set multiple mail...
    I suppose to split email with ;

    I mean t='from@mail.com,to1@mail.com;to2@mail'
    if I don't need to set bcc reply... etc etc

    or I need to made an e element for every mail I sent?

  6. #6
    Join Date
    Oct 2009
    Location
    Dublin, IRELAND
    Posts
    712
    Rep Power
    7

    Default

    You need one element per addressee.

Similar Threads

  1. Delete a calendar appointment via SOAP
    By kkuilla in forum Developers
    Replies: 5
    Last Post: 04-28-2010, 03:07 AM
  2. Can recives but can't send mail outgoing
    By hoangkk in forum Installation
    Replies: 9
    Last Post: 09-21-2009, 07:35 PM
  3. zmzimletctl deploy zimbra_posixaccount.zip - ERROR -
    By todd_dsm in forum Administrators
    Replies: 0
    Last Post: 04-02-2009, 01:41 PM
  4. 4.0.4 to 4.5.6 upgrade failed in network edition
    By chenthil in forum Administrators
    Replies: 1
    Last Post: 08-27-2007, 09:36 AM
  5. [SOLVED] Simple backup question...
    By dameron in forum Administrators
    Replies: 3
    Last Post: 08-25-2007, 09:36 PM

Posting Permissions

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