ical-org / ical.net

ical.NET - an open source iCal library for .NET
MIT License
784 stars 231 forks source link

How can I find the rest of the instances of a recurring event? #572

Closed aristosv closed 18 hours ago

aristosv commented 1 year ago

Hello,

I am using ical.net in PowerShell to find calendar events.

# Install-Package iCal.Net -Force

# load assemblies
Write-Host loading assemblies -ForegroundColor Green
Add-Type -LiteralPath 'C:\Program Files\PackageManagement\NuGet\Packages\NodaTime.3.1.9\lib\netstandard2.0\NodaTime.dll'
Add-Type -LiteralPath 'C:\Program Files\PackageManagement\NuGet\Packages\Ical.Net.4.2.0\lib\netstandard2.0\Ical.Net.dll'

# define ics url
Write-Host defining ics url -ForegroundColor Green
$icsurl = 'https://url_to/basic.ics'

# load ics
Write-Host invoking web request -ForegroundColor Green
$response = Invoke-WebRequest $icsurl

# deserialize ICS
Write-Host deserializing ics -ForegroundColor Green
$calendar = [Ical.Net.Calendar]::Load( $response.Content )

$calendar.events

My problem is that I can only detect the first instance of a recurring event. How can I find the rest of the instances of this recurring event?

rincew1nd commented 8 months ago

Having the same problem here. Not all of the occurances are returning by calling for Calendar.GetOccurrences method. Sometimes it works, sometimes it doesn't...