set fileRef to choose file name with prompt "出力ファイルの指定" default name "event.csv"

open for access fileRef with write permission

set all_event to ""
tell application "Microsoft Entourage"
activate
set event_list to ID of events
repeat with event_id in event_list
display dialog event_id
set subject_field to subject of event id event_id
set subject_field to "\"" & subject_field & "\""

set location_field to location of event id event_id
set location_field to "\"" & location_field & "\""

set content_field to content of event id event_id
set content_field to "\"" & content_field & "\""

set start_field to start time of event id event_id
set end_field to end time of event id event_id
set allday_field to all day event of event id event_id
set recurring_field to recurring of event id event_id
set recurrence_field to recurrence of event id event_id

set line_field to subject_field & "," & location_field & "," & content_field & "," & start_field & "," & end_field
if allday_field then
set line_field to line_field & "," & "終日"
else
set line_field to line_field & ","
end if

if recurring_field then
set line_field to line_field & "," & recurrence_field
else
set line_field to line_field & ","
end if

set all_event to all_event & line_field & return

end repeat
end tell
write all_event to fileRef
close access fileRef