Skip to content

Multi-value property support (ATTENDEE, CATEGORIES) #2

@PhilflowIO

Description

@PhilflowIO

Problem

Properties like ATTENDEE and CATEGORIES can have multiple values, but current implementation only handles single string values.

Example

BEGIN:VEVENT
ATTENDEE;CN=Alice:mailto:alice@example.com
ATTENDEE;CN=Bob:mailto:bob@example.com
ATTENDEE;CN=Charlie:mailto:charlie@example.com
CATEGORIES:MEETING,WORK,IMPORTANT
END:VEVENT

Current Behavior

// Only updates the first ATTENDEE
updateFields(event, {
  'ATTENDEE': 'mailto:newperson@example.com'
});

Desired Behavior

// Support array of values
updateFields(event, {
  'ATTENDEE': [
    'mailto:alice@example.com',
    'mailto:bob@example.com'
  ],
  'CATEGORIES': ['MEETING', 'WORK']
});

Implementation Considerations

  • Need to detect multi-value properties
  • Handle both single string and array inputs
  • Preserve property parameters (CN, ROLE, etc. for ATTENDEE)
  • Stay true to field-agnostic philosophy

Workaround

Use ical.js directly for multi-value properties:

import ICAL from 'ical.js';

const component = new ICAL.Component(ICAL.parse(event.data));
const vevent = component.getFirstSubcomponent('vevent');

// Add multiple attendees
const attendees = [
  'mailto:alice@example.com',
  'mailto:bob@example.com'
];

// Remove existing
vevent.removeAllProperties('attendee');

// Add new ones
attendees.forEach(email => {
  vevent.addPropertyWithValue('attendee', email);
});

// Use tsdav-utils for other fields
const updated = updateFields(component.toString(), {
  'SUMMARY': 'Team Meeting'
});

Related

  • RFC 5545 Section 3.8.4.1 (ATTENDEE)
  • RFC 5545 Section 3.8.1.2 (CATEGORIES)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions