/// <summary> /// Define the task item via setting different kind of taskRecurrence value. /// </summary> /// <param name="subject">The subject of the task.</param> /// <param name="taskRecurrence">Recurrence element value of the task.</param> /// <returns>The task object.</returns> public static TaskType DefineTaskItem(string subject, TaskRecurrenceType taskRecurrence) { #region Define Task item TaskType taskItem = new TaskType { // The subject of a task. Subject = subject, // The actual amount of time that is spent on a task. ActualWork = 5, ActualWorkSpecified = true, // The total amount of time that is associated with a task. TotalWork = 10, TotalWorkSpecified = true, // The billing information for a task. BillingInformation = "Discount: 10 dollars", // The collection of companies that are associated with a task. Companies = new string[] { "CompanyFirst", "CompanySecond" }, // The collection of contacts that are associated with a task. Contacts = new string[] { "Alice", "Bob" }, // The start date of a task. The start date cannot occur after due date. StartDate = DateTime.Parse("2011-8-4"), StartDateSpecified = true, // The due date of a task. The due date cannot occur before start date. DueDate = DateTime.Parse("2011-8-10"), DueDateSpecified = true, // The mileage for a task. Mileage = "15 km.", // The completion percentage of a task. PercentComplete = 50, PercentCompleteSpecified = true }; // The recurrence of a task. if (taskRecurrence != null) { taskItem.Recurrence = taskRecurrence; } #endregion return taskItem; }