The question I have is how to download binary attachment data from Zimbra calendar events, using their SOAP API.
I obtain the data for a single event by calling the API "GetAppointmentRequest". This yields most of the information I need, such as event title, date/time, attendee list, etc. It also yields a list of attachments, if present. For text attachments, the text is embedded within the json, so no problem there. For binary attachments, I get something like this:
{
"part": "2",
"ct": "image/jpeg",
"s": 639415,
"cd": "attachment",
"filename": "fence2.jpg"
}
I've seen some discussion online that it is possible to take the "id" value of the calendar item and make a call to "GetMsgRequest" in order to obtain the attachment data, but when I try it, all that results is a http 500 server error.
Can anyone provide guidance on how calendar attachments may be retrieved?
I have received some documentation from the Zimbra people on how to do this:
When making a GetMsgRequest, the id value must be provided in the form:
<calItemId>-<invite_mail_item_id>
For example, if your calendar item ID is 294, then the ID to be used inside the GetMsgRequest should be: 294-293.
You can find the invite_mail_item_id (293 in this example) under the invitation object in the GetAppointmentResponse.
Example snippet from the GetAppointmentResponse:
"GetAppointmentResponse": {
"appt": [
{
"id": "294",
"inv": [
{
"id": 293,
"comp": ...,
"mp": [
{
"part": "2",
"ct": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"cd": "attachment",
"filename": "dummy.xlsx"
}
]
}
]
}
]
}
Fetching the actual attachment once you have the correct ID (for example, 294-293), you can download the attachment directly by calling:
https://<server>/service/home/~/?auth=co&id=<calItemId>-<invite_mail_item_id>&part=<partNumber>