# vcalendar export
import e32calendar, appuifw

cal = e32calendar.open()
if len(cal) == 0:
    appuifw.note( u"No calendar entries.", "info" )
id_list=list()
for id in cal:
    id_list.append(id)

vCal = cal.export_vcalendars(tuple(id_list))

# define the directory and file name
vCalendar = u"e:\\vCal.vcf"

# create file
file = open(vCalendar, 'w')

# write vcal into file and close the file
file.write(vCal)
file.close()

appuifw.note( u"Success!", "info" )
