Re: [Evolution] Event/Task Attachments Working?



On Thu, 2011-06-23 at 11:24 -0400, Adam Tauno Williams wrote:
Does anyone have an example of working attachments to an event to task
when using a CalDAV calendar or task list?

I've gotten it working;  Now whenever users upload an attachment to a
workorder/task I can access the file directly from my Evolution To-Do
list.  The trick(s) were to upgrade to the latest Evolution [3.0.x] and
that Vobject automatically base64 encodes the attachment value [so if
you do it yourself you end up with base64 encoded base64 encoded data].

The vobject code to pull this off, and make a happy Evolution client,
looks like:

    # ATTACHMENTS
    if task.attachments:
      for attachment in task.attachments:
        print attachment
        handle = ctx.run_command('attachment::get-handle',
attachment=attachment)
        if handle:
          data = handle.read()
          attach = todo.add('attach')
          attach.encoding_param = 'BASE64'
          attach.value_param = 'BINARY'
          if attachment.webdav_uid:
            attach.x_oracle_filename_param = attachment.webdav_uid
            attach.x_coils_filename_param = attachment.webdav_uid
            attach.x_evolution_caldav_attachment_name_param =
attachment.webdav_uid
            attach.x_coils_attachment_uuid_param = attachment.uuid
            attach.x_coils_attachment_size_param = str(attachment.size)
            attach.fmttype_param = attachment.mimetype
            attach.value = data

Since I could find this information no where I figured it was worth
posting somewhere.
<http://vobject.skyhouseconsulting.com/>
<https://sourceforge.net/projects/coils/>




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]