Skip to content

Calendar Event Attendees & Organizers Bug #612

Description

@evrim

Hello again,

I have good news and bad news. The good news is I've debugged and found the bug. Here are the bad news:

from icalendar import Calendar, Event, vCalAddress, vText

def add_attendee(event, email):
    if not email:
        return
    email = email.strip()
    if not email:
        return
    a = vCalAddress(f"mailto:{email}")
    a.params['CN'] = vText(email.split('@')[0] if '@' in email else email)
    a.params['ROLE'] = vText('REQ-PARTICIPANT')
    a.params['PARTSTAT'] = vText('NEEDS-ACTION')
    a.params['CUTYPE'] = vText('INDIVIDUAL')
    a.params['RSVP'] = vText('TRUE')
    event.add('ATTENDEE', a)

def set_organizer(event, email):
    if not email:
        return
    email = email.strip()
    o = vCalAddress(f"mailto:{email}")
    o.params['CN'] = vText(email.split('@')[0] if '@' in email else email)
    event['ORGANIZER'] = o

# Usage
cal = Calendar()
event = Event()

set_organizer(event, "foo@example.com")
for e in ["bar@example.com", "baz@example.com"]:
    add_attendee(event, e)

So the attendees and organizer is in vCalAddress format. Otherwise nextcloud 32 won't show the box for attendees. I have no idea how to modify the Tool API to tell LLM to provide name/email (possibly in Dict?). Only then I was able to make it work. Organizer I believe should be set to the current user Name/Email.

Note that organizer is added as event['ORGANIZER'] = o not event.add('ORGANIZER', ..). AI tells me this is singleton in ICS spec.

Best,
evrim.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions