יצירת משימה חוזרת
Contents
[
Hide
]
VSTO
להלן קטע קוד המציג חזרה של משימה על בסיס תאריך:
Outlook.TaskItem task = Application.CreateItem(
Outlook.OlItemType.olTaskItem) as Outlook.TaskItem;
task.Subject = "Tax Preparation";
task.StartDate = DateTime.Parse("4/1/2007 8:00 AM");
task.DueDate = DateTime.Parse("4/15/2007 8:00 AM");
Outlook.RecurrencePattern pattern = task.GetRecurrencePattern();
pattern.RecurrenceType = Outlook.OlRecurrenceType.olRecursYearly;
pattern.PatternStartDate = DateTime.Parse("4/1/2007");
pattern.NoEndDate = true;
task.ReminderSet = true;
task.ReminderTime = DateTime.Parse("4/1/2007 8:00 AM");
task.Save();
Aspose.Email
Aspose.Email ל-.NET מאפשרת ליצור משימות Outlook ולשמור אותן בפורמט MSG. ה MapiTask מחלקה זו מספקת מספר מאפיינים כגון Percentcomplete, Estimatedeffort, ActualEffort, History, LastUpdate ואחרים, על מנת להכיל ולהגדיר מידע נדרש למשימת Outlook. מאמר זה מציג כיצד ליצור, לשמור ולקרוא MapiTask מהדיסק.
Aspose.Email מאפשר ליצור משימה חוזרת שבה החזרה יכולה להיות יומית, שבועית, חודשית או שנתית. קטע הקוד שלהלן מדגים יצירת משימה עם חזרה שבועית.
DateTime startDate = new DateTime(2015, 04, 30, 10, 00, 00);
MapiTask task = new MapiTask("abc", "def", startDate, startDate.AddHours(1));
task.State = MapiTaskState.NotAssigned;
// Set the weekly recurrence
var rec = new MapiCalendarDailyRecurrencePattern
{
PatternType = MapiCalendarRecurrencePatternType.Day,
Period = 1,
WeekStartDay = DayOfWeek.Sunday,
EndType = MapiCalendarRecurrenceEndType.NeverEnd,
OccurrenceCount = 0,
};
task.Recurrence = rec;
task.Save("AsposeDaily.msg", TaskSaveFormat.Msg);