ניהול חזרות
עבודה עם חזרות יומיומיות
Aspose.Email תומך ביצירת חזרות יומיומיות באמצעות MapiCalendarDailyRecurrencePattern. ניתן להשתמש בשלושה סוגי סיום שונים של חזרת לוח שנה של Mapi כולל EndAfterNOccurrences, EndAfterDate ו-NeverEnd. קטע זה מציג את יצירת תבניות חזרת יומיומיות שונות.
חזרות יומיומיות עם ספירת אירועים
בסוג חזרה זה, יש לקבוע את מספר החזרות יחד עם מידע נוסף כדלקמן:
- הגדר תאריך התחלה, סיום ותאריך יעד.
- צור MapiTask.
- הגדר את מצב המשימה ל-NotAssigned.
- צור את אובייקט החזרה היומי על ידי הגדרת המאפיינים כגון PatternType, Period, WeekStartDay, EndType ו‑OccurenceCount.
- הגדר את המאפיין MapiTask.Recurrence לאובייקט החזרה היומי הזה.
- שמור הודעה זו בדיסק.
קטע קוד זה מציג כיצד ליצור משימה עם סוג סיום חזרה EndAfterNOccurrence.
// The path to the File directory.
string dataDir = RunExamples.GetDataDir_Outlook();
TimeZone localZone = TimeZone.CurrentTimeZone;
TimeSpan timeSpan = localZone.GetUtcOffset(DateTime.Now);
DateTime StartDate = new DateTime(2015, 7, 16);
StartDate = StartDate.Add(timeSpan);
DateTime DueDate = new DateTime(2015, 7, 16);
DateTime endByDate = new DateTime(2015, 8, 1);
DueDate = DueDate.Add(timeSpan);
endByDate = endByDate.Add(timeSpan);
MapiTask task = new MapiTask("This is test task", "Sample Body", StartDate, DueDate);
task.State = MapiTaskState.NotAssigned;
// Set the Daily recurrence
var rec = new MapiCalendarDailyRecurrencePattern
{
PatternType = MapiCalendarRecurrencePatternType.Day,
Period = 1,
WeekStartDay = DayOfWeek.Sunday,
EndType = MapiCalendarRecurrenceEndType.EndAfterNOccurrences,
OccurrenceCount = GetOccurrenceCount(StartDate, endByDate, "FREQ=DAILY"),
};
if (rec.OccurrenceCount==0)
{
rec.OccurrenceCount = 1;
}
task.Recurrence = rec;
task.Save(dataDir + "Daily_out.msg", TaskSaveFormat.Msg);
ניתן להשתמש בפונקציה הבאה לחישוב מספר האירועים בין שני התאריכים:
private static uint GetOccurrenceCount(DateTime start, DateTime endBy, string rrule)
{
CalendarRecurrence pattern = new CalendarRecurrence(string.Format("DTSTART:{0}\r\nRRULE:{1}", start.ToString("yyyyMMdd"), rrule));
DateCollection dates = pattern.GenerateOccurrences(start, endBy);
return (uint)dates.Count;
}
הגדרת ערך ספירת החזרות
הקטע הקוד הבא מראה כיצד להגדיר את ערך ספירת החזרות.
// Set the Daily recurrence
var record = new MapiCalendarDailyRecurrencePattern
{
PatternType = MapiCalendarRecurrencePatternType.Day,
Period = 1,
WeekStartDay = DayOfWeek.Sunday,
EndType = MapiCalendarRecurrenceEndType.EndAfterNOccurrences,
OccurrenceCount = 5,
};
task.Recurrence = record;
חזרות יומיות: סוג סיום EndAfterDate
"End By" אפשרות ב-Mapi Task מושגת על ידי הגדרת המאפיין OccurrenceCount המחושב על ידי הפונקציה GetOccurrenceCount(). הפונקציה מקבלת תאריך התחלה, תאריך סיום ומחרוזת RRULE.
חזרות יומיומיות: הגדרת ערך ‘כל יום’
הקטע הקוד הבא מראה כיצד להגדיר את ערך ה-period ל-1 ואת ערך ה-INTERVAL ל-1 במחרוזת RRULE גם כן.
// Set the Daily recurrence
var record = new MapiCalendarDailyRecurrencePattern
{
PatternType = MapiCalendarRecurrencePatternType.Day,
Period = 1,
EndType = MapiCalendarRecurrenceEndType.EndAfterDate,
OccurrenceCount = GetOccurrenceCount(StartDate, endByDate, "FREQ=DAILY;INTERVAL=1"),
EndDate = endByDate
};
ניתן להגדיר את ערך Every Day לכל ערך מתאים כפי שמוצג בדוגמה הבאה:
// Set the Daily recurrence
var record = new MapiCalendarDailyRecurrencePattern
{
PatternType = MapiCalendarRecurrencePatternType.Day,
Period = 2,
EndType = MapiCalendarRecurrenceEndType.EndAfterDate,
OccurrenceCount = GetOccurrenceCount(StartDate, endByDate, "FREQ=DAILY;INTERVAL=2"),
};
חזרות יומיות: סוג סיום NeverEnd
ניתן להגדיר סוג סיום באמצעות MapiCalendarRecurrenceEndType.NeverEnd. ניתן להגדיר את Period או INTERVAL לערך הדרוש, לדוגמה 1, בדוגמה הבאה.
// Set the Daily recurrence
var record = new MapiCalendarDailyRecurrencePattern
{
PatternType = MapiCalendarRecurrencePatternType.Day,
Period = 1,
EndType = MapiCalendarRecurrenceEndType.NeverEnd,
};
עבודה עם חזרות שבועיות
Aspose.Email מציעה תכונות עשירות ליצירת חזרות שבועיות באמצעות MapiCalendarWeeklyRecurrencePattern. ניתן להשתמש בשלושה סוגי סיום שונים של חזרה בלוח השנה של Mapi כולל EndAfterNOccurrences, EndAfterDate ו-NeverEnd. קטע זה מציג את יצירת תבניות חזרה שבועיות שונות.
חזרות שבועיות: סוג סיום EndAfterNOccurrences
בסוג חזרה זה, יש לקבוע את מספר החזרות יחד עם מידע נוסף כדלקמן:
- הגדר תאריך התחלה, סיום ותאריך יעד.
- צור MapiTask.
- הגדר את מצב המשימה ל-NotAssigned.
- צור את אובייקט החזרה השבועית על ידי קביעת המאפיינים כמו PatternType, Period, WeekStartDay, EndType ו-OccurenceCount.
- הגדר את המאפיין MapiTask.Recurrence אל אובייקט החזרה השבועית הזה.
- שמור הודעה זו בדיסק.
קטע הקוד הבא מציג כיצד ליצור משימה עם סוג סיום חזרה כ- EndAfterNOccurrence.
// The path to the File directory.
string dataDir = RunExamples.GetDataDir_Outlook();
TimeZone localZone = TimeZone.CurrentTimeZone;
TimeSpan ts = localZone.GetUtcOffset(DateTime.Now);
DateTime StartDate = new DateTime(2015, 7, 16);
StartDate = StartDate.Add(ts);
DateTime DueDate = new DateTime(2015, 7, 16);
DateTime endByDate = new DateTime(2015, 9, 1);
DueDate = DueDate.Add(ts);
endByDate = endByDate.Add(ts);
MapiTask task = new MapiTask("This is test task", "Sample Body", StartDate, DueDate);
task.State = MapiTaskState.NotAssigned;
// Set the weekly recurrence
var rec = new MapiCalendarWeeklyRecurrencePattern
{
EndType = MapiCalendarRecurrenceEndType.EndAfterNOccurrences,
PatternType = MapiCalendarRecurrencePatternType.Week,
Period = 1,
WeekStartDay = DayOfWeek.Sunday,
DayOfWeek = MapiCalendarDayOfWeek.Friday,
OccurrenceCount = GetOccurrenceCount(StartDate, endByDate, "FREQ=WEEKLY;BYDAY=FR"),
};
if (rec.OccurrenceCount == 0)
{
rec.OccurrenceCount = 1;
}
task.Recurrence = rec;
task.Save(dataDir + "Weekly_out.msg", TaskSaveFormat.Msg);
ניתן להשתמש בפונקציה הבאה לחישוב מספר האירועים בין שני התאריכים:
private static uint GetOccurrenceCount(DateTime start, DateTime endBy, string rrule)
{
CalendarRecurrence pattern = new CalendarRecurrence(string.Format("DTSTART:{0}\r\nRRULE:{1}", start.ToString("yyyyMMdd"),rrule));
DateCollection dates = pattern.GenerateOccurrences(start, endBy);
return (uint)dates.Count;
}
בחירת מספר ימים בשבוע
הקטע הקוד הבא מראה כיצד לבחור מספר ימות בשבוע.
// Set the weekly recurrence
var rec = new MapiCalendarWeeklyRecurrencePattern
{
EndType = MapiCalendarRecurrenceEndType.EndAfterNOccurrences,
PatternType = MapiCalendarRecurrencePatternType.Week,
Period = 1,
WeekStartDay = DayOfWeek.Sunday,
DayOfWeek = MapiCalendarDayOfWeek.Friday | MapiCalendarDayOfWeek.Monday,
OccurrenceCount = GetOccurrenceCount(StartDate, endByDate, "FREQ=WEEKLY;BYDAY=FR,MO"),
};
בחירת מספר ימים בשבוע והגדרת מרווחים
הקטע הקוד הבא מראה כיצד לבחור מספר ימות בשבוע ולהגדיר מרווחים.
// Set the weekly recurrence
var rec = new MapiCalendarWeeklyRecurrencePattern
{
EndType = MapiCalendarRecurrenceEndType.EndAfterNOccurrences,
PatternType = MapiCalendarRecurrencePatternType.Week,
Period = 2,
WeekStartDay = DayOfWeek.Sunday,
DayOfWeek = MapiCalendarDayOfWeek.Friday | MapiCalendarDayOfWeek.Monday,
OccurrenceCount = GetOccurrenceCount(StartDate, endByDate, "FREQ=WEEKLY;BYDAY=FR,MO;INTERVAL=2"),
};
חזרות שבועיות: סוג סיום EndAfterDate
"End By" אפשרות ב-Mapi Task מושגת על ידי הגדרת המאפיין OccurrenceCount המחושב על ידי הפונקציה GetOccurrenceCount(). הפונקציה מקבלת תאריך התחלה, תאריך סיום ומחרוזת RRULE.
חזרות שבועיות: הגדרת ערך ‘כל יום’
הקטע הקוד הבא מראה כיצד להגדיר את ערך ה-period ל-1 ואת ערך ה-INTERVAL ל-1 במחרוזת RRULE גם כן.
// Set the weekly recurrence
var rec = new MapiCalendarWeeklyRecurrencePattern
{
EndType = MapiCalendarRecurrenceEndType.EndAfterDate,
PatternType = MapiCalendarRecurrencePatternType.Week,
Period = 1,
WeekStartDay = DayOfWeek.Sunday,
DayOfWeek = MapiCalendarDayOfWeek.Friday,
EndDate = endByDate,
OccurrenceCount = GetOccurrenceCount(StartDate, endByDate, "FREQ=WEEKLY;BYDAY=FR;INTERVAL=1"),
};
ניתן להגדיר את ערך Every Day לכל ערך מתאים ולבחור מספר ימות כפי שמוצג בדוגמה הבאה:
var record = new MapiCalendarWeeklyRecurrencePattern
{
EndType = MapiCalendarRecurrenceEndType.EndAfterDate,
PatternType = MapiCalendarRecurrencePatternType.Week,
Period = 2,
WeekStartDay = DayOfWeek.Sunday,
EndDate = endByDate,
DayOfWeek = MapiCalendarDayOfWeek.Friday | MapiCalendarDayOfWeek.Monday,
OccurrenceCount = GetOccurrenceCount(StartDate, endByDate, "FREQ=WEEKLY;BYDAY=FR,MO;INTERVAL=2"),
};
חזרות שבועיות: סוג סיום NeverEnd
ניתן להגדיר סוג סיום באמצעות MapiCalendarRecurrenceEndType.NeverEnd. ניתן להגדיר את Period או INTERVAL לערך הדרוש, לדוגמה 1, בדוגמה הבאה.
// Set the weekly recurrence
var recurrence = new MapiCalendarWeeklyRecurrencePattern
{
EndType = MapiCalendarRecurrenceEndType.NeverEnd,
PatternType = MapiCalendarRecurrencePatternType.Week,
Period = 1,
WeekStartDay = DayOfWeek.Sunday,
DayOfWeek = MapiCalendarDayOfWeek.Friday,
OccurrenceCount = GetOccurrenceCount(StartDate, endByDate, "FREQ=WEEKLY;BYDAY=FR"),
};
עבודה עם חזרות חודשיות
Aspose.Email תומך ביצירת חזרות חודשיות באמצעות MapiCalendarMonthlyRecurrencePattern. ניתן להשתמש בשלושה סוגי סיום שונים של חזרת לוח שנה של Mapi כולל EndAfterNOccurrences, EndAfterDate ו-NeverEnd. קטע זה מציג את יצירת תבניות חזרה חודשיות שונות.
חזרות חודשיות: סוג סיום EndAfterNOccurrences
בסוג חזרה זה, יש לקבוע את מספר החזרות יחד עם מידע נוסף כדלקמן:
- הגדר תאריך התחלה, סיום ותאריך יעד.
- צור MapiTask.
- הגדר את מצב המשימה ל-NotAssigned.
- צור את אובייקט החזרה החודשי על ידי קביעת המאפיינים כמו PatternType, Period, WeekStartDay, EndType ו-OccurenceCount.
- הגדר את המאפיין MapiTask.Recurrence אל אובייקט החזרה החודשי הזה.
- שמור הודעה זו בדיסק.
קטע הקוד הבא מציג כיצד ליצור משימה עם סוג סיום חזרה כ- EndAfterNOccurrence.
// The path to the File directory.
string dataDir = RunExamples.GetDataDir_Outlook();
TimeZone localZone = TimeZone.CurrentTimeZone;
TimeSpan ts = localZone.GetUtcOffset(DateTime.Now);
DateTime StartDate = new DateTime(2015, 7, 16);
StartDate = StartDate.Add(ts);
DateTime DueDate = new DateTime(2015, 7, 16);
DateTime endByDate = new DateTime(2015, 12, 31);
DueDate = DueDate.Add(ts);
endByDate = endByDate.Add(ts);
MapiTask task = new MapiTask("This is test task", "Sample Body", StartDate, DueDate);
task.State = MapiTaskState.NotAssigned;
// Set the Monthly recurrence
var rec = new MapiCalendarMonthlyRecurrencePattern
{
Day = 15,
Period = 1,
PatternType = MapiCalendarRecurrencePatternType.Month,
EndType = MapiCalendarRecurrenceEndType.EndAfterNOccurrences,
OccurrenceCount = GetOccurrenceCount(StartDate, endByDate, "FREQ=MONTHLY;BYMONTHDAY=15;INTERVAL=1"),
WeekStartDay = DayOfWeek.Monday,
};
if (rec.OccurrenceCount == 0)
{
rec.OccurrenceCount = 1;
}
task.Recurrence = rec;
//task.Save(dataDir + "Monthly_out.msg", TaskSaveFormat.Msg);
ניתן להשתמש בפונקציה הבאה לחישוב מספר האירועים בין שני התאריכים:
private static uint GetOccurrenceCount(DateTime start, DateTime endBy, string rrule)
{
CalendarRecurrence pattern = new CalendarRecurrence(string.Format("DTSTART:{0}\r\nRRULE:{1}", start.ToString("yyyyMMdd"), rrule));
DateCollection dates = pattern.GenerateOccurrences(start, endBy);
return (uint)dates.Count;
}
הגדרת מספר קבוע של אירועים
קטע הקוד הבא מציג כיצד להגדיר מספר קבוע של אירועים.
// Set the Monthly recurrence
var records = new MapiCalendarMonthlyRecurrencePattern
{
Day = 15,
Period = 1,
PatternType = MapiCalendarRecurrencePatternType.Month,
EndType = MapiCalendarRecurrenceEndType.EndAfterNOccurrences,
OccurrenceCount = 5,
WeekStartDay = DayOfWeek.Monday
};
חזרות חודשיות: סוג סיום EndAfterDate
"End By" אפשרות ב-Mapi Task מושגת על ידי הגדרת המאפיין OccurrenceCount המחושב על ידי הפונקציה GetOccurrenceCount(). הפונקציה מקבלת תאריך התחלה, תאריך סיום ומחרוזת RRULE. קטע הקוד הבא מציג כיצד ליצור חזרה בתאריך ה-15 של כל חודש בין תאריך התחלה ותאריך סיום.
// The path to the File directory.
string dataDir = RunExamples.GetDataDir_Outlook();
TimeZone localZone = TimeZone.CurrentTimeZone;
TimeSpan ts = localZone.GetUtcOffset(DateTime.Now);
DateTime StartDate = new DateTime(2015, 7, 1);
StartDate = StartDate.Add(ts);
DateTime DueDate = new DateTime(2015, 7, 1);
DateTime endByDate = new DateTime(2015, 12, 31);
DueDate = DueDate.Add(ts);
endByDate = endByDate.Add(ts);
MapiTask task = new MapiTask("This is test task", "Sample Body", StartDate, DueDate);
task.State = MapiTaskState.NotAssigned;
// Set the Monthly recurrence
var recurrence = new MapiCalendarMonthlyRecurrencePattern
{
Day = 15,
Period = 1,
PatternType = MapiCalendarRecurrencePatternType.Month,
EndType = MapiCalendarRecurrenceEndType.EndAfterDate,
OccurrenceCount = GetOccurrenceCount(StartDate, endByDate, "FREQ=MONTHLY;BYMONTHDAY=15;INTERVAL=1"),
WeekStartDay = DayOfWeek.Monday,
EndDate = endByDate
};
task.Recurrence = recurrence;
//task.Save(dataDir + "SetMonthlyEndAfterDateRecurrence_out.msg", TaskSaveFormat.Msg);
חזרות חודשיות: סוג סיום NeverEnd
קטע הקוד הבא מציג כיצד להגדיר את סוג הסיום באמצעות MapiCalendarRecurrenceEndType.NeverEnd.
var recurrence = new MapiCalendarMonthlyRecurrencePattern
{
Day = 15,
Period = 1,
PatternType = MapiCalendarRecurrencePatternType.Month,
EndType = MapiCalendarRecurrenceEndType.NeverEnd,
WeekStartDay = DayOfWeek.Monday,
};
עבודה עם חזרות שנתיות
Aspose.Email תומך ביצירת חזרות שנתיות באמצעות MapiCalendarMonthlyRecurrencePattern. על ידי קביעת מאפיין period ל-12, ניתן להשיג תבנית חזרה שנתית. ניתן להשתמש בשלושה סוגי סיום שונים של חזרה בלוח השנה של Mapi כולל EndAfterNOccurrences, EndAfterDate ו-NeverEnd. קטע זה מציג את יצירת תבניות חזרה שנתיות שונות.
חזרות שנתיות: סוג סיום EndAfterNOccurrences
בסוג חזרה זה, יש לקבוע את מספר החזרות יחד עם מידע נוסף כדלקמן:
- הגדר תאריך התחלה, סיום ותאריך יעד.
- צור MapiTask.
- הגדר את מצב המשימה ל-NotAssigned.
- צור את אובייקט החזרה החודשי על ידי קביעת המאפיינים כמו PatternType, Period, WeekStartDay, EndType ו-OccurenceCount.
- הגדר את המאפיין MapiTask.Recurrence אל אובייקט החזרה החודשי הזה כדי להשיג חזרה שנתית.
- שמור הודעה זו בדיסק.
קטע הקוד הבא מציג כיצד ליצור משימה עם סוג סיום חזרה כ- EndAfterNOccurrence.
TimeZone localZone = TimeZone.CurrentTimeZone;
TimeSpan ts = localZone.GetUtcOffset(DateTime.Now);
DateTime StartDate = new DateTime(2015, 7, 1);
StartDate = StartDate.Add(ts);
DateTime DueDate = new DateTime(2015, 7, 1);
DateTime endByDate = new DateTime(2020, 12, 31);
DueDate = DueDate.Add(ts);
endByDate = endByDate.Add(ts);
MapiTask task = new MapiTask("This is test task", "Sample Body", StartDate, DueDate);
task.State = MapiTaskState.NotAssigned;
// Set the Yearly recurrence
var recurrence = new MapiCalendarMonthlyRecurrencePattern
{
Day = 15,
Period = 12,
PatternType = MapiCalendarRecurrencePatternType.Month,
EndType = MapiCalendarRecurrenceEndType.EndAfterNOccurrences,
OccurrenceCount = 3,
};
task.Recurrence = recurrence;
task.Save("Yearly.msg", TaskSaveFormat.Msg);
חזרות שנתיות: סוג סיום EndAfterDate
"End By" אפשרות ב-Mapi Task מושגת על ידי הגדרת המאפיין OccurrenceCount המחושב על ידי הפונקציה GetOccurrenceCount(). הפונקציה מקבלת תאריך התחלה, תאריך סיום ומחרוזת RRULE. קטע הקוד הבא מציג כיצד ליצור חזרה בתאריך ה-15 של כל חודש שביעי בין תאריך התחלה ותאריך סיום.
// Set the Yearly recurrence
var rec = new MapiCalendarMonthlyRecurrencePattern
{
Day = 15,
Period = 12,
PatternType = MapiCalendarRecurrencePatternType.Month,
EndType = MapiCalendarRecurrenceEndType.EndAfterDate,
EndDate = endByDate,
OccurrenceCount = GetOccurrenceCount(StartDate, endByDate, "FREQ=YEARLY;BYMONTHDAY=15;BYMONTH=7;INTERVAL=1"),
};
task.Recurrence = rec;
חזרות שנתיות: סוג סיום NeverEnd
קטע הקוד הבא מציג כיצד להגדיר את סוג הסיום באמצעות MapiCalendarRecurrenceEndType.NeverEnd.
// Set the Yearly recurrence
var recurrence = new MapiCalendarMonthlyRecurrencePattern
{
Day = 15,
Period = 12,
PatternType = MapiCalendarRecurrencePatternType.Month,
EndType = MapiCalendarRecurrenceEndType.NeverEnd,
};
יצירת חזרה מתוך כלל חזרה
ממשק ה-API של Aspose.Email מספק אפשרות ליצור תבנית חזרה מתוך כלל חזרה (RRULE). הוא מנתח את המידע מהמחרוזת RRULE לפי תקן RFC 5545 iCal ומייצר את תבנית החזרה באמצעות השיטה MapiCalendarRecurrencePatternFactory.FromString. קטע הקוד הבא מציג כיצד ליצור תבנית חזרה מתוך כלל חזרה.
// The path to the File directory.
string dataDir = RunExamples.GetDataDir_Outlook();
DateTime startDate = new DateTime(2015, 7, 16);
DateTime endDate = new DateTime(2015, 8, 1);
MapiCalendar app1 = new MapiCalendar("test location", "test summary", "test description", startDate, endDate);
app1.StartDate = startDate;
app1.EndDate = endDate;
string pattern = "DTSTART;TZID=Europe/London:20150831T080000\r\nDTEND;TZID=Europe/London:20150831T083000\r\nRRULE:FREQ=DAILY;INTERVAL=1;COUNT=7\r\nEXDATE:20150831T070000Z,20150904T070000Z";
app1.Recurrence.RecurrencePattern = MapiCalendarRecurrencePatternFactory.FromString(pattern);
הוספת קובץ מצורף לאירועי לוח שנה חוזרים
API של Aspose.Email מאפשרת להוסיף קבצים מצורפים לאירועי לוח שנה חוזרים.
DateTime startDate = new DateTime(2018, 7, 19).AddHours(12);
MapiCalendar calendar = new MapiCalendar("location1", "summary1", "description1", startDate, startDate.AddHours(1));
MapiCalendarEventRecurrence recurrence = new MapiCalendarEventRecurrence();
MapiCalendarRecurrencePattern pattern = recurrence.RecurrencePattern = new MapiCalendarDailyRecurrencePattern();
pattern.PatternType = MapiCalendarRecurrencePatternType.Day;
pattern.Period = 1;
pattern.EndType = MapiCalendarRecurrenceEndType.NeverEnd;
DateTime exceptionDate = startDate.AddDays(3);
MapiCalendarExceptionInfo exception = new MapiCalendarExceptionInfo
{
Location = "exceptionLoc",
Subject = "exceptionSubj",
Body = "exceptionBody",
OriginalStartDate = exceptionDate,
StartDateTime = exceptionDate,
EndDateTime = exceptionDate.AddHours(5),
Attachments = new MapiAttachmentCollection(calendar)
};
exception.Attachments.Add("file.txt", Encoding.ASCII.GetBytes("hello, world!"));
pattern.Exceptions.Add(exception);
pattern.ModifiedInstanceDates.Add(exceptionDate);
pattern.DeletedInstanceDates.Add(exceptionDate);
calendar.Recurrence = recurrence;
using (var newPst = PersonalStorage.Create(dataDir + "AddAttachmentToMapiExceptionInfo.pst", FileFormatVersion.Unicode))
{
var newFolder = newPst.CreatePredefinedFolder("Calendar", StandardIpmFolder.Appointments);
newFolder.AddMapiMessageItem(calendar);
}