Quick Start With iCalendar API

iCalendar API

Aspose.Email Cloud API supports working with iCalendar files. You can use our API to read, edit and save iCalendar (.ics) files. Also, you can convert them to AlternateView and add them to email messages.

Our SDKs support two different ways of operating with iCalendar files using property sets and data transfer object CalendarDto. This tutorial shows how to use CalendarDto.

Create Calendar File Object and Save It to Storage

CalendarDto  object contains all information about an appointment including attendees, start date, end date, description and etc.

First, let’s create a CalendarDto object and save it to Storage.

To save a CalendarDto to Storage use SaveCalendarModelAsync from EmailApi. This method requires 1 parameter —  SaveCalendarModelRequest, which is a request model for this operation. 

SaveCalendarModelRequest requires 2 parameters: Name — iCalendar file name in storage and StorageModelRqOfCalendarDto object — calendar properties update request. 

StorageModelRqOfCalendarDto has 2 parameters:

How to create a CalendarDto object and save it to the Storage?

Download iCalendar File From Storage

You can find the saved file on Aspose.Cloud Dashboard, or download it using SDK.

To download a file from the storage use DownloadFileAsync from EmailApi. This method requires 1 parameter — DownloadFileRequest, which is a request for this operation.

DownloadFileRequest has 3 parameters:

  • Path — File path e.g. “/folder/file.ext”.
  • StorageName — Storage name.
  • VersionId [optional] — File version ID to download.

How to download iCalendar file from the Storage?

Get Calendar File From Storage as CalendarDto Object

Let’s get this file from storage as a CalendarDto object.

To get a calendar file from Storage use GetCalendarModelAsync  from EmailApi. This method requires 1 parameter —  GetCalendarModelRequest, which is a request for this operation.

GetCalendarModelRequest has 3 parameters:

  • Name — iCalendar file name in storage.
  • Folder — Path to the folder in storage.
  • Storage — Storage name.

How to get a file from the Storage as a CalendarDto object?


You can change model fields and save it again. The file will be rewritten if you don’t change file name and location.

Convert Calendar Object to AlternateView

We also provide API methods for converting CalendarDto to an AlternateView. AlternateView can be added to EmailDto, which can be saved as EML file or sent using a built-in email client.

To convert a CalendarDto object to AlternateView use ConvertCalendarModelToAlternateAsync from EmailApi. This method requires 1 parameter — ConvertCalendarModelToAlternateRequest, which is a request for this operation. This request has 1 parameter — CalendarDtoAlternateRq (iCalendar document as AlternateView request).

CalendarDtoAlternateRq has 3 parameters:

  • Value — iCalendar document model.
  • Action — iCalendar actions. Enum, available values: Create, Update, Cancel.
  • SequenceId — iCalendar sequence id.

How to convert CalendarDto to an AlternateView?

Get a List of iCalendar Files From One Folder

You can get a list of iCalendar files stored in one folder on storage using a single API request. Files will be filtered by “.ics” extension and read to list of CalendarDto object. The method supports pagination.

To get a list of iCalendar files use GetCalendarModelListAsync from EmailApi. This method requires 1 parameter — GetCalendarModelListRequest, which is a request for this operation.

GetCalendarModelListRequest has 4 parameters:

  • Folder — Path to the folder in storage.
  • ItemsPerPage — Count of items on page.
  • PageNumber — Page number.
  • Storage — Storage name.

How to get a list of iCalendar files stored in one folder?

More Tutorials

See more Aspose Email tutorials: