GAS-ICS-Sync icon indicating copy to clipboard operation
GAS-ICS-Sync copied to clipboard

"Parsed 0 events from ical sources" from Moodle Calendar URL export

Open hambergerpls opened this issue 4 years ago • 8 comments

Hi, I'm trying to import a Moodle calendar URL link into the script but it did not fetch any events from the url

URL: https://smartv3.ums.edu.my/calendar/export_execute.php?userid=50129&authtoken=3240f8f614fb86a8445eda299e87fd6a85ca5afd&preset_what=all&preset_time=recentupcoming

Log:

Jan 2, 2021, 3:41:55 PM	Info	Result: 1
Jan 2, 2021, 3:41:55 PM	Info	Syncing 1 calendars to SmartUMS
Jan 2, 2021, 3:41:55 PM	Info	Working on calendar: [email protected]
Jan 2, 2021, 3:41:55 PM	Info	Fetched 0 existing events from SmartUMS
Jan 2, 2021, 3:41:55 PM	Info	Parsed 0 events from ical sources
Jan 2, 2021, 3:41:55 PM	Info	Processing 0 events
Jan 2, 2021, 3:41:55 PM	Info	Done processing events
Jan 2, 2021, 3:41:55 PM	Info	Checking 0 events for removal
Jan 2, 2021, 3:41:55 PM	Info	Done checking events for removal
Jan 2, 2021, 3:41:55 PM	Info	Processing 0 Recurrence Instances!
Jan 2, 2021, 3:41:55 PM	Info	Sync finished!

When I input the URL in the browser, it downloads the .ics file and I'm able to import it to Google Calendars with the events, but when I use the URL directly in Calendar, it couldn't find any events. I also noticed that the URL is not in iCal format, so I'm not sure if that is the cause.

hambergerpls avatar Jan 02 '21 08:01 hambergerpls

The URL returns an empty calendar. Does it require some additional type of authentication?

jonas0b1011001 avatar Jan 02 '21 09:01 jonas0b1011001

I don't think it requires any additional authentication since the link downloads the icalexport.ics file if I try the link in incognito but it didn't work when I import through URL in Google Calendar and GAS.

The body response I got from postman is this:

BEGIN:VCALENDAR
METHOD:PUBLISH
PRODID:-//John Papaioannou/NONSGML Bennu 0.1//EN
VERSION:2.0
END:VCALENDAR

hambergerpls avatar Jan 02 '21 16:01 hambergerpls

So it looks like the ICS is being returned, but is empty. I would expect an auth issue would mean you get nothing back. Maybe something isn't set up properly for publishing in Moodle? Or maybe there's no events that match the "filters" you have in the URL (preset_what=all&preset_time=recentupcoming)?

I also noticed that the URL is not in iCal format

Likely not an issue - a URL doesn't have to end in ".ics" or ".ical" to be a valid calendar.

the link downloads the icalexport.ics file if I try the link in incognito

Are you willing to share this?

derekantrican avatar Jan 02 '21 16:01 derekantrican

I see this, are you referencing those directions? https://docs.moodle.org/310/en/Using_Calendar#Dynamic_Link_to_Moodle_Calendar

derekantrican avatar Jan 02 '21 16:01 derekantrican

I see this, are you referencing those directions? https://docs.moodle.org/310/en/Using_Calendar#Dynamic_Link_to_Moodle_Calendar

Yes

So it looks like the ICS is being returned, but is empty. I would expect an auth issue would mean you get nothing back. Maybe something isn't set up properly for publishing in Moodle? Or maybe there's no events that match the "filters" you have in the URL (preset_what=all&preset_time=recentupcoming)?

I also noticed that the URL is not in iCal format

Likely not an issue - a URL doesn't have to end in ".ics" or ".ical" to be a valid calendar.

the link downloads the icalexport.ics file if I try the link in incognito

Are you willing to share this?

Okay I felt silly for not being thorough. I didn't realise that there were a size difference in ics file when I try in incognito and when I try it while logged into my Moodle. It does require an authentication to get the events

Here's the result icalexport.ics (While logged in)

BEGIN:VCALENDAR
METHOD:PUBLISH
PRODID:-//John Papaioannou/NONSGML Bennu 0.1//EN
VERSION:2.0
BEGIN:VEVENT
UID:[email protected]
SUMMARY:WEEK 11: Designing mobile apps &amp\; web should be completed
DESCRIPTION:Week 11 class will be conducted through async mode. Students ar
	e required to watch the lecture using the provided link. \n\n
	
CLASS:PUBLIC
LAST-MODIFIED:20201228T000947Z
DTSTAMP:20210103T014714Z
DTSTART:20210101T160000Z
DTEND:20210101T160000Z
CATEGORIES:KP34703 [1-2020/2021]
END:VEVENT
BEGIN:VEVENT
UID:[email protected]
SUMMARY:WEEK 11: Group Activity Submission - async mode
DESCRIPTION:Each GROUP is required to audit their SmartHome apps design usi
	ng the 25 principles proposed by Google Team (only 6 principles has been ex
	plained in the video).\n\nProvide a special checklist report consist of the
	 evaluation of your SmartHome apps. \n
	
... (TRIMMED)

CLASS:PUBLIC
LAST-MODIFIED:20201230T235250Z
DTSTAMP:20210103T014714Z
DTSTART:20210115T155500Z
DTEND:20210115T155500Z
CATEGORIES:KP00703 [1-2020/2021]
END:VEVENT
END:VCALENDAR

hambergerpls avatar Jan 03 '21 01:01 hambergerpls

Ok, may be related to #157? I might contact you later to test out that feature

derekantrican avatar Jan 03 '21 02:01 derekantrican

I did a quick test on the Moodle Demo Page and the export link created on there seems to work fine regardless of incognito mode on/off.

As this does not look like a general Moodle problem maybe the admins of your uni's webpage can help you out with this one.

jonas0b1011001 avatar Jan 03 '21 12:01 jonas0b1011001

I think this can help with this issue.

ProgramComputer avatar Aug 26 '21 00:08 ProgramComputer