No Occurence being generated



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.

Here is a sample pattern I am using


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

Any ideas??



Hmm, I think it is a licensing issue (forgot to put SetLicense in play). However now I am getting nowhere using the license:

I am putting this at the top of each method that calls any of the iCalendar classes:

Aspose.iCalendar.License license = new Aspose.iCalendar.License();

The .lic file is in the root of the project, and I have also tried to put it in various folders or the Resources.

Any ideas on this?

Cheers (again),



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);

Surely there is an easier way I am missing??



This explains

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.