Running the same action (e.g. Import Calendar Events | Drafts Directory, but really any script to get calendar events) on either device, my iPhone lists all the same calendars I can see on my iPad, but when I try to import events, the iPhone fails to return events within specific calendars (the iPad has no such problem).
Calendar settings are the same. I’ve tried toggling calendar access in Drafts settings— no effect. So: same action/script, same calendar access, same calendar settings (far as I can see), different events returned depending on device. Can’t think what else to check. Anything obvious I may have overlooked?
Usage: I have a daily note action that lists my agenda for the day. I usually initiate it on my phone. Recently realised that the output sometimes fails to list all of the day’s events… tracked the issue down to this discrepancy between devices.
Those events show up in the Calendar app, but not when the script it run? Most likely case seems one where iOS had not synced the calendar in the background yet. Are the effected calendars backed by iCloud, Google?
Calendars backed by iCloud. Events are all present and visible in calendars on both devices (issue seems to be specifically with “Birthday” calendars…), not waiting on syncing…
Still haven’t been able to work this one out. One question: if there are a few calendars with the same name, what will Calendar.find()
do? Would it return all of the events from all of the calendars with the same name (as Shortcuts seems to do) or would it only return events from one of those calendars (e.g. first or last)?
I think the issue I’m seeing is affecting the Birthdays calendar. I have more than one, automatically generated by my Google accounts and my iCloud account, all with the same name. So I’m wondering if that has something to do with it? If so, I need to figure out how to target a calendar within a specific account, or find some other workaround…
UPDATE: I think that’s sorted it. I assumed I couldn’t rename the autogenerated calendars (can’t see how to do so with the iCloud one generated from contacts) but I just had to make changes at the Google end for those ones. With the calendar names rendered unique, it looks like I’m getting all the events through that I would expect on both devices. My guess is that if targeting a calendar name that’s shared with more than one calendar, Calendar.find()
gets events from only one of those calendars, maybe dependent on the order in which the accounts were added to the device, which could end up returning different results, as I’ve experienced.
I’d be interested to know if I’m barking up the right/wrong tree, but either way, I think I’ve got this particular problem solved now.
1 Like
That checks out. Calendar.find
is only going to return the first calendar with a matching name.
If you intentional want to have multiple calendars with the same name (which sounds error prone), you can use Calendar.getAll()
to retreive all calendars and do your own merging of events.
1 Like
Thanks. Definitely not my intention to maintain a small handful of calendars with the same name, it’s just one of those things I never had a reason to pay close attention to, having a few different accounts on different platforms and rolling with the defaults. Glad I was able to figure out what was needed/possible.