I am new to this product (Aspose.iCalendar v1.2.1.0) but I get the gist of it. I have my rules and patterns saving appropriately, but when I try to use the GenerateOccurrences method I come up with a count of 0 dates each time.
Not sure what I am doing wrong here. I want this rule to start on April 18th and finish on June 23rd. It should run only on weekdays at 14:32. When I use the following code I get zero dates returned:
private DateTime GetNextExecuteDate(string pattern) { RecurrencePattern pat = new RecurrencePattern(pattern); DateCollection dates = pat.GenerateOccurrences(); return (dates.Count > 0?dates[0]:DateTime.Parse("1/1/1970")); // assume jan 1 1970 is null date }
Well, I got it to work with a bit of senseless coding. What I did was imbed the .lic file into the Resources. Then I used the following code to read the license infomation from the Resource and convert it into a stream (the only input usable for the SetLicense method unless the file pathing works).
Aspose.iCalendar.License license = new Aspose.iCalendar.License(); ResourceManager rm = new ResourceManager("CMSAlerts.Properties.Resources", Assembly.GetExecutingAssembly()); Byte[] bytes = (byte[])rm.GetObject("Aspose_iCalendar"); MemoryStream mst = new MemoryStream(bytes); license.SetLicense((Stream)mst);
This explains [http://www.aspose.com/wiki/default.aspx/Aspose.iCalendar/Licensing.html](https://forum.aspose.com/wiki/default.aspx/Aspose.iCalendar/Licensing.html)
Putting the license into the project folder does not work. It has to be in the same folder as Aspose.iCalendar.dll or your project executable for the pathless approach to work.
Also you can embed the license in your project and then calling Setlicense just with the name (without the path) will find it in the resources.
After that there is of course an option to specify explicit path.