Calendar.WorkWeeks

Calendar.WorkWeeks property

Gets WorkWeekCollections object. The collection of work weeks that is associated with the calendar.

public WorkWeekCollection WorkWeeks { get; }

Examples

Shows how to read work week information.

var project = new Project(DataDir + "WorkWithWorkWeekCollection.mpp");
var calendar = project.Calendars.GetByUid(1);

foreach (var workWeek in calendar.WorkWeeks)
{
    // Display work week name, from and to dates
    var name = workWeek.Name;
    var fromDate = workWeek.FromDate;
    var toDate = workWeek.ToDate;
    Console.WriteLine("Name: " + name);
    Console.WriteLine("From Date: " + fromDate);
    Console.WriteLine("To Date: " + toDate);

    // This data is all about "Details." button you can set special working times for special WeekDay or even make it nonworking
    foreach (var day in workWeek.WeekDays)
    {
        // You can further traverse through working times and display these
        foreach (var workingTime in day.WorkingTimes)
        {
            Console.WriteLine(workingTime.From);
            Console.WriteLine(workingTime.To);
        }
    }
}

See Also