CalendarCollection.GetByName

CalendarCollection.GetByName method

Returns a calendar with the specified name.

public Calendar GetByName(string name)
ParameterTypeDescription
nameStringName of a calendar.

Return Value

If found returns calendar with a specified name else returns null.

Examples

Shows how to get calendars by name or by id.

var project = new Project(DataDir + "Project5.mpp");

var calendarByName = project.Calendars.GetByName("TestCalendar");
var calendarByUid = project.Calendars.GetByUid(4);

Console.WriteLine("Calendar Name: " + calendarByName.Name);
Console.WriteLine("Calendar Name: " + calendarByUid.Name);
Console.WriteLine("Are calendars equals: " + calendarByName.Equals(calendarByUid));

See Also