Skip to content

Commit

Permalink
Warn about recurring events
Browse files Browse the repository at this point in the history
Recurring events will be complex to get right, so we will not support
them at all in initial version.
  • Loading branch information
zdevaty committed May 17, 2024
1 parent 99af251 commit 8e0cca4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions USER-GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,7 @@ If the booking is made by a user without Exchange account (or an Ad-hoc booking)
## Booking Timing

When creating or deleting a booking from Eliona, the booking will be visible in Outlook in a few seconds. Changes made in Outlook are synchronized to Eliona every `refreshInterval` seconds.

## Recurring events

For technical reasons, recurring events are not yet supported.
12 changes: 12 additions & 0 deletions ews/ews.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ type calendarItem struct {
Start time.Time `xml:"Start"`
End time.Time `xml:"End"`
Organizer organizer `xml:"Organizer"`
CalendarItemType string `xml:"CalendarItemType"`
}

type itemId struct {
Expand Down Expand Up @@ -300,6 +301,7 @@ func (h *EWSHelper) GetRoomAppointments(roomEmail string, syncState string) (new
<t:FieldURI FieldURI="calendar:Start"/>
<t:FieldURI FieldURI="calendar:End"/>
<t:FieldURI FieldURI="calendar:Organizer"/>
<t:FieldURI FieldURI="calendar:CalendarItemType"/>
</t:AdditionalProperties>
</m:ItemShape>
<m:SyncFolderId>
Expand Down Expand Up @@ -342,6 +344,11 @@ func (h *EWSHelper) GetRoomAppointments(roomEmail string, syncState string) (new
return nil, nil, nil, syncState, fmt.Errorf("resolving distinguished name '%s': %v", item.Organizer.Mailbox.EmailAddress, err)
}

if change.CalendarItem.CalendarItemType == "RecurringMaster" {
log.Warn("EWS", "A recurring event was created for %s by %s. Recurring events are not supported!", roomEmail, organizerEmail)
continue
}

new = append(new, model.Booking{
ExchangeIDInResourceMailbox: item.ItemId.Id,
ExchangeUID: item.UID,
Expand All @@ -363,6 +370,11 @@ func (h *EWSHelper) GetRoomAppointments(roomEmail string, syncState string) (new
return nil, nil, nil, syncState, fmt.Errorf("resolving distinguished name '%s': %v", item.Organizer.Mailbox.EmailAddress, err)
}

if change.CalendarItem.CalendarItemType == "RecurringMaster" {
log.Warn("EWS", "A recurring event was updated for %s by %s. Recurring events are not supported!", roomEmail, organizerEmail)
continue
}

updated = append(updated, model.Booking{
ExchangeIDInResourceMailbox: item.ItemId.Id,
ExchangeUID: item.UID,
Expand Down

0 comments on commit 8e0cca4

Please sign in to comment.