derekantrican / GAS-ICS-Sync

A Google Apps Script for syncing ICS/ICAL files faster than the current Google Calendar speed
GNU General Public License v3.0
1.5k stars 192 forks source link

[Request] Add ical attendees to gcal description #401

Closed impca201 closed 8 months ago

impca201 commented 8 months ago

Is your feature request related to a problem? Please describe.

When attendees are synced from ical to gcal, the events appear duplicate in the attendees' calendars.

Describe the solution you'd like

I would like to be able to see attendees to an event in gcal, without having duplicate events in the attendees' calendars. Is there any way to add the attendees to the description in gcal instead of the attendees field?

Additional context

No response

jonas0b1011001 commented 8 months ago

Remove Helpers.gs lines 464+465

  if (event.hasProperty('description'))
    newEvent.description = icalEvent.description;

Replace Helpers.gs lines 400-418 with:

  if (event.hasProperty('description'))
    newEvent.description = icalEvent.description;

  if (addAttendees && event.hasProperty('attendee')){
    var attendeesString = "\nAttendees:\n";
    for (var att of icalEvent.attendees){
      var mail = parseAttendeeMail(att.toICALString());
      if (mail != null){
        var name = parseAttendeeName(att.toICALString());
        var resp = parseAttendeeResp(att.toICALString());
        if (resp != null) {
          attendeesString += name + " <" + mail + "> - Status: " + resp + "\n";
        } else {
          attendeesString += name + " <" + mail + ">\n";
        }
      }
    }
    newEvent.description = (newEvent.description || '') + attendeesString;
  }
impca201 commented 8 months ago

Unfortunately, this did not work. (I removed the gcal events to have it sync from scratch. Also updated attAttendees setting.)

jonas0b1011001 commented 8 months ago

I'll need more info than does not work. You get an error? Wrong output?

Seems to work fine for me on v5.8, changes from above, addAttendees = true;

impca201 commented 8 months ago

There's no error, the attendees are just not being added to the description.

I wanted to check if maybe the attendees were somehow missing from the ics source, so I added this text to your code: newEvent.description = (newEvent.description || '') + attendeesString + "ATTENDEES SHOULD BE HERE"; This text is also not showing in the description. However I'm not sure if I formatted things correctly.

I also started from scratch by copying the script again and creating a new calendar, same issue.

addAttendees is set to true. Description itself is syncing properly.

jonas0b1011001 commented 8 months ago

I wanted to check if maybe the attendees were somehow missing from the ics source, so I added this text to your code:

The code won't execute if the event has no attendee property. You can download the ics file and open it in any text editor to check if attendees are exported properly.

However I'm not sure if I formatted things correctly.

Can you share your function createEvent() so we can validate the formatting?

impca201 commented 8 months ago

You can download the ics file and open it in any text editor to check if attendees are exported properly. So, it turns out my Outlook ics does not contain the attendees data - apologies.