Create a weekly recurring task throws an exception

Hi,

I’m trying to create a weekly recurring task using the code below:

MapiCalendarWeeklyRecurrencePattern pattern = new MapiCalendarWeeklyRecurrencePattern();
			pattern.setPatternType(MapiCalendarRecurrencePatternType.Week);
		
			pattern.setWeekStartDay(MapiCalendarDayOfWeek.Sunday);
			pattern.setPeriod(1);
			pattern.setDayOfWeek(MapiCalendarDayOfWeek.Saturday);
			pattern.setEndType(MapiCalendarRecurrenceEndType.NeverEnd);
			
			task.setRecurrence(pattern);

This code throws the following exception:
Specified argument was out of the range of valid values.

Can you tell me what can I do to complete this task?

Thanks

@kelberuc1,
Thank you for the query. I will answer you later. Thank you for your patience.

@kelberuc1,
Unfortunately, I can not use your code example containing the unknown task symbol. Could you share a comprehensive code example reproducing the error, please? Also, please specify the version of Aspose.Email you used.

Dear @Andrey_Potapov,

You can use any MapiTask object for this example.
So please use this:
MapiTask task = new MapiTask();

Is it OK now?

@kelberuc1,
Thank you for the additional information. Unfortunately, I haven’t managed to reproduce the exception “Specified argument was out of the range of valid values”. Could you share a simple project reproducing the error, please?