Sun Java System Calendar Server 6.3 WCAP Developer's Guide

Fetching Attachments

    Attachments can be output from the server through multiple ways.

  1. Fetch_by_* commands : All commands that you can use to fetch the event will now have an extra argument to fetch attachment within the event itself.

  2. fetchattach = 0/1 : A value of '0' does not return the attachment within the ical event structure but only return information about the event as follows:


    <>BEGIN:VEVENT
    UID:uid1
    RECURRENCE-ID:rid1
    DTSTAMP:20050919T165229Z
    SUMMARY:Calendar Server Engineering meeting
    DTSTART:20050919T223000Z
    DTEND:20050919T233000Z
    CREATED:20050627T184431Z
    LAST-MODIFIED:20050829T221947Z
    PRIORITY:5
    SEQUENCE:5
    CLASS:PUBLIC
    ORGANIZER;CN="Your Name"
     ;X-NSCP-ORGANIZER-UID=Short Name
     ;X-S1CS-EMAIL=firstname.lastname@email.com
     :savri
    ATTACH;X-S1CS-ATTACH-ID=attach-id1
    ;X-S1CS-CLIENT-ATTACH-ID=client-attach-id1
    ;FMTTYPE=text/plain
    ;X-S1CS-FILENAME=test.txt
    ;X-S1CS-FILESIZE=347
    :http://host:port/fetchattachments.wcap?uid=uid1&rid=rid1
    &attach-id=attach-id1
    ATTACH;X-S1CS-ATTACH-ID=attach-id2
    ;FMTTYPE=image/jpeg
    X-S1CS-FILENAME=pic.jpeg
    ;X-S1CS-FILESIZE=4355
    <>:http://host:port/fetchattachments.wcap?uid=uid1&rid=rid1
    &attach-id=attach-id2
    STATUS:CONFIRMED
    TRANSP:OPAQUE
    X-NSCP-ORIGINAL-DTSTART:20050919T223000Z
    X-NSCP-LANGUAGE:en
    X-NSCP-DTSTART-TZID:America/Los_Angeles
    X-NSCP-TOMBSTONE:0
    X-NSCP-ONGOING:0
    X-NSCP-ORGANIZER-EMAIL:firstname.lastname@email.com
    X-NSCP-GSE-COMPONENT-STATE;X-NSCP-GSE-COMMENT=
    "REQUEST-PENDING":131073
    END:VEVENT

    Note –

    The X-S1CS-CLIENT-ATTACH-ID will be emitted out only if the client had supplied its own id while storing the attachment. The URI is a WCAP URL that can be used by clients in conjunction with the session id to fetch the actual attachment.


A value of '1' to the fetchattachment command yields the actual attachment within the event itself as follows:


BEGIN:VEVENT
UID:uid1
RECURRENCE-ID:rid1
DTSTAMP:20050919T165229Z
SUMMARY:Calendar Server Engineering meeting
DTSTART:20050919T223000Z
DTEND:20050919T233000Z
CREATED:20050627T184431Z
LAST-MODIFIED:20050829T221947Z
PRIORITY:5
SEQUENCE:5
CLASS:PUBLIC
ORGANIZER;CN="Your Name"
 ;X-NSCP-ORGANIZER-UID=Short Name
 ;X-S1CS-EMAIL=firstname.lastname@email.com
 :savri
ATTACH;;X-S1CS-ATTACH-ID=attach-id1
  ;X-S1CS-CLIENT-ATTACH-ID=client-attach-id1
  ;X-S1CS-FILENAME=pic.jpeg
  ;FMTTYPE=image/basic;ENCODING=BASE64;VALUE=BINARY:
      MIICajCCAdOgAwIBAgICBEUwDQYJKoZIhvcNAQEEBQAwdzELMAkGA1U
      EBhMCVVMxLDAqBgNVBAoTI05ldHNjYXBlIENvbW11bmljYXRpb25zIE
        <...remainder of "BASE64" encoded binary data...>

ATTACH;;X-S1CS-ATTACH-ID=attach-id2
 ;X-S1CS-FILENAME=pic2.jpeg
 ;FMTYPE=IMAGE/JPEG;ENCODING=BASE64;VALUE=BINARY:MIICajC
      CAdOgAwIBAgICBEUwDQYJKoZIhvcNAQEEBQAwdzELMAkGA1UEBhMCVVMxLDA
      qBgNVBAoTI05ldHNjYXBlIENvbW11bmljYXRpb25zIENvcnBvcmF0aW9uMRw
      <...remainder of "BASE64" encoded binary data...>

STATUS:CONFIRMED
TRANSP:OPAQUE
X-NSCP-ORIGINAL-DTSTART:20050919T223000Z
X-NSCP-LANGUAGE:en
X-NSCP-DTSTART-TZID:America/Los_Angeles
X-NSCP-TOMBSTONE:0
X-NSCP-ONGOING:0
X-NSCP-ORGANIZER-EMAIL:firstname.lastname@email.com
X-NSCP-GSE-COMPONENT-STATE;X-NSCP-GSE-COMMENT="REQUEST-PENDING":131073
END:VEVENT

Tip –

It is advisable to specify fetchattach=0, to accelerate the response of fetch command in case there are lots of attachments. Instead, use the URL in the VEVENT to fetch the actual attachment when requested by the end user.