Attachments can be stored as part of an event using the storeevents command over the http post command. Attachment data resides in an internal data store events separate from the database where events and tasks are stored. Each attachment is assigned a unique ID, called an attachment ID. Events and tasks contain the attachment ID's rather than the actual attachment data. The following is a list of attachment features:
All commands used to fetch events and tasks can take a fetchattach parameter. This parameter indicates whether or not to return actual attachments stored for the event or task, or return just the information about all the attachments, "0"for no attachments fetched, or "1" for returning specific attachments stored for the event or task.
When the fetchattach parameter is passed in with a value of "0", WCAP emits the following kind of data:
The server-assigned ID of the attachment.
The client-specified ID of the attachment.
The content type specified for the attachment.
The following is an example of the data returned by the fetch commands when you specify "0" as the value of the fetchattach parameter:
ATTACH;X-S1CS-ATTACH-ID=attach-P001; FMTTYPE=image/jpeg X-S1CS-FILENAME=pic.jpeg :http://fetchattachments.wcap?uid=uid1&rid=rid1&attach-id=attach-P001
There is a specific fetch command, fetchattachment.wcap, for fetching only the attachments for a particular event or task.
Using the storeevents command, you can delete the attachments for an event, by sending the deleteattach parameter, without deleting the event.
Attachments can be sent to attendees outside the Calendar Server deployment in an email as part of the iTIP invitation, depending on the value of the sendattach parameter, in the storeevents command. A value of "0" means do not send the attachment and a value of "1" means to send the attachment.
The export command uses the fetchattach parameter to determine whether it should send a URL to an attachment ("0"), or the actual attachment itself ("1").
As part of the new attachment support model, the old attachment parameter has been deprecated. However, for backwards compatibility, it remains functional.
There are two parts that comprise the attachment support solution:
Attachment store: Acts as a repository for storing the attached files.
Calendar Server attachment support: Responsible for various tasks, which are required to store, fetch, act upon, and delete attachments.
The attachment store acts as a repository for the Calendar Server attachments.
The following features encapsulate the functionality of the attachment store:
Supports unique attachment ids for indexing and easy identification of the attachment. The id will be supplied by the store to guarantee uniqueness across applications.
Holds reference to UID-RID of the event that the supplied file is attached to, possibly in the metadata.
Uses hard links to depict multiple events/instances that point to the same attachment id.
Provides APIs to the Calendar Server to store, delete, and fetch attachments.
Provides a place holder for any meta data (for example, size of the file and name) that could be of use to the Calendar Server.
Supports cleaning up of orphan attachments.
The life cycle of an attachment explains the process of creating, sending, storing, and deleting an attachment from the Calendar Server. The following example illustrates the life cycle of an attachment by explaining the procedure to attach a file from your system and delete it in the Calendar Server:
Click the New Event link in the Calendar, to create a new event in the Communications Express.
The New Event window opens up. You need to specify the event details such as Title, Start Time, End Time, Type, Privacy, people to invite and so on for the new event.
Click Add Attachment icon in the Attachments section, to add file as an attachment.
The Attach File window opens up.
Click the Browse button.
Select the file that you want to attach from the File Upload dialog box.
Click the Add icon to add the file in the attachments list.
You can see the name and size of the file in the attachments list. You can add multiple attachments to the list by clicking the Browse button and selecting the required files. You can also delete the selected attachments from the list by clicking the Delete icon in the Action tab.
Click the Attach icon to add the selected attachments in the Attachments list box in the New event window.
Click the Save icon to save the attachment.
The saved attachment is displayed as an event against the corresponding timing in the Calendar.
Calendar Server issues storeevents.wcap command, which provides all the information about the attachment. Calendar Server stores the attachment file in the attachment store and keeps a reference to the attachment within the event structure. For more information on the storeevents command, refer the storeevents.wcap section.
Click the event at any point of time to view its details.
Communications Express issues the fetchevents_by_id and provides the Calendar Server with all the information about the attachment. It also sends fetchattach=0. For more information on fetchevents_by_id command, refer the fetchevents_by_id.wcap section. In response to the fetchevents_by_id command, the server provides information about the attachment such as attachment id, size of attachment, URL to retrieve the attachment, client id if any was supplied, the file name of the original file attached and so on.
The client displays the attachment in the form of a URL.
Click the URL to view the attached file.
Communications Express issues fetchattachment.wcap command to the server. The server sends back the data about the attachment in the form of HTTP response.
Delete the attachment (at any point of time) from the event.
Communications Express issues the storeevents command and supplies the deleteid parameter along with it. The deleteid parameter contains the ID of the attachment to be deleted. The server deletes the attachment from the back-end attachment store.