Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add attendees? #131

Closed
mihristov opened this issue Dec 2, 2020 · 5 comments · Fixed by #140
Closed

add attendees? #131

mihristov opened this issue Dec 2, 2020 · 5 comments · Fixed by #140
Assignees
Labels
feature new feature request question

Comments

@mihristov
Copy link

Hi. I need to add attendees to the event. Does that library support it?

@jshor
Copy link
Owner

jshor commented Dec 2, 2020

For now, Datebook doesn't have an elegant way of adding attendees (though this will change in a future version). However, here's how you'd accomplish it using the library:

iCalendar

For iCalendar, you'll need to use addProperty() with the key set to ATTENDEE, with any desired options appended:

Example:

const icalendar = (new ICalendar(options))
  .addProperty('ATTENDEE;ROLE=REQ-PARTICIPANT;CN=John Doe', 'MAILTO:[email protected]')
  .addProperty('ATTENDEE;ROLE=OPT-PARTICIPANT;CN=Jane Doe', 'MAILTO:[email protected]')
  .render()

Optional Parameters:

  • CN - Name of the attendee
  • DELEGATED-FROM - Delegatee of the request
  • PARTSTAT - Participation status
  • ROLE - Required, optional, etc.
  • RSVP - Whether or not to RSVP automatically (TRUE or FALSE)
  • SENT-BY - Event sender

Outlook Web Calendar

For OWA, you'll need to add the to query string param (for required attendees) and cc (for optional attendees), using comma-separated list of guests as the values.

Example:

let outlookWeb = (new OutlookCalendar(options)).render()

outlookWeb += `&to=John Doe <[email protected]>,Jane Doe <[email protected]>&cc=Billy Joel <[email protected]>`

Google Calendar

For Google Calendar, you'll need to add the add query string param, with a comma-separated list of guests as the value. Note: the differentiation between optional and required is not supported.

Example:

let googleCalendar = (new GoogleCalendar(options)).render()

googleCalendar += `&add=John Doe <[email protected]>,Jane Doe <[email protected]>`

Yahoo Calendar

For Yahoo Calendar, you'll need to add the inv_list query string param, with a comma-separated list of guests as the value. Note: the differentiation between optional and required is not supported.

Example:

let yahooCalendar = (new YahooCalendar (options)).render()

yahooCalendar += `&inv_list=John Doe <[email protected]>,Jane Doe <[email protected]>`

@csakai
Copy link
Collaborator

csakai commented Dec 2, 2020

Josh and I spoke about this earlier. I will take a crack at it. Should be able to submit a PR today or tomorrow.

@rvmladenov
Copy link

If I add 2 people for ics - I am still missing the second person

@jshor
Copy link
Owner

jshor commented Dec 4, 2020

@rvmladenov what does your code look like? This fiddle shows the two attendees added when rendered:

const { ICalendar } = window.datebook

const ics = new ICalendar({
  title: 'Happy Hour',
  location: 'The Bar, New York, NY',
  description: 'Let\'s blow off some steam with a tall cold one!',
  start: new Date('2022-07-08T19:00:00'),
  end: new Date('2022-07-08T23:30:00'),
  // an event that recurs every two weeks:
  recurrence: {
    frequency: 'WEEKLY',
    interval: 2
  }
})
  .addProperty('ATTENDEE;ROLE=REQ-PARTICIPANT;CN=John Doe', 'MAILTO:[email protected]')
  .addProperty('ATTENDEE;ROLE=OPT-PARTICIPANT;CN=Jane Doe', 'MAILTO:[email protected]')
  .render()

console.log('ICS data: ', ics)

Output

BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VEVENT
CLASS:PUBLIC
DESCRIPTION:Let's blow off some steam with a tall cold one!
DTSTART:20220708T230000Z
DTEND:20220709T033000Z
LOCATION:The Bar, New York, NY
SUMMARY:Happy Hour
TRANSP:TRANSPARENT
RRULE:FREQ=WEEKLY;INTERVAL=2
ATTENDEE;ROLE=REQ-PARTICIPANT;CN=John Doe:MAILTO:[email protected]
ATTENDEE;ROLE=OPT-PARTICIPANT;CN=Jane Doe:MAILTO:[email protected]
END:VEVENT
END:VCALENDAR
UID:3v73hqcfdnh
DTSTAMP:20201204
PRODID:fiddle.jshell.net

@jshor jshor assigned csakai and jshor Dec 5, 2020
@jshor jshor added feature new feature request question labels Dec 5, 2020
@csakai
Copy link
Collaborator

csakai commented Dec 6, 2020

Just wanted to give a little update, I know I said I'd have something in on Thursday or Friday. Life, ya know? Anyway, I'm currently implementing attendees for each calendar type. The query string types are pretty trivial, but the ICal type is a little tricky. On first blush, it looks like it may need a refactor, but it might not be necessary. It's doable, I may submit the full functionality for ICal separately.

csakai added a commit to csakai/datebook that referenced this issue Jan 5, 2021
Add an array of CalendarAttendee objects to each calendar type which describes attendee name, email,
and ICS-specific options

implement jshor#131
jshor pushed a commit to csakai/datebook that referenced this issue Jan 5, 2021
Adds an array of CalendarAttendee objects to each calendar type which
describes attendee name, email, and ICS-specific options.

Implements jshor#131
@jshor jshor linked a pull request Jan 5, 2021 that will close this issue
@jshor jshor closed this as completed in #140 Jan 5, 2021
jshor pushed a commit that referenced this issue Jan 5, 2021
Adds an array of CalendarAttendee objects to each calendar type which
describes attendee name, email, and ICS-specific options.

Implements #131
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature new feature request question
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants