Show Yes No May be options in ICS file using Python #540
Unanswered
shohagcsediu
asked this question in
Q&A
Replies: 2 comments
-
Hi shohagcsediu, will this snippet do? import datetime
from datetime import datetime
from icalendar import Calendar, Event, vText, vCalAddress
calendar = Calendar()
calendar.add('prodid', 'icalendar')
calendar.add('version', '2.0')
attende_that_accepted = vCalAddress(f'mailto:[email protected]')
attende_that_accepted.params['PARSTAT'] = vText('ACCEPTED')
attende_that_declined = vCalAddress(f'mailto:[email protected]')
attende_that_declined.params['PARSTAT'] = vText('DECLINED')
tentative_attende = vCalAddress(f'mailto:[email protected]')
tentative_attende.params['PARSTAT'] = vText('TENTATIVE')
event = Event()
event.add('DTSTART', datetime(2022, 7, 22, 12, 30))
event.add('DTEND', datetime(2022, 7, 22, 16, 30))
event.add('DTSTAMP', datetime.now())
event.add('UID', 'unique-id')
event.add('description', 'Birthday party')
event.add('attendee', attende_that_accepted)
event.add('attendee', attende_that_declined)
event.add('attendee', tentative_attende)
calendar.add_component(event)
print(calendar.to_ical().decode('utf-8')) The output:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
If that is it, it can be put into the documentation.
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
How to add Yes No May be options in ICS file using Python? please let me know if anyone implemented it.
Beta Was this translation helpful? Give feedback.
All reactions