Calendars and EWS in ExchangeCalendars and EWS in Exchange
了解 Exchange 中的日历、日历文件夹和项目、约会和会议。Learn about calendars, calendar folders and items, appointments, and meetings in Exchange.
您可能已经熟悉电子邮件客户端（如 Outlook）中的许多日历功能，这使您能够跟踪约会、安排会议、检查人员的可用性、邀请与会者以及更改或取消会议。You're probably familiar with many of the calendar features in email clients like Outlook, which enable you to track appointments, schedule meetings, check people's availability, invite attendees, and change or cancel meetings.
Exchange 中日历相关的功能与在客户端（如 Outlook）中看到的功能稍有不同。Calendar-related features in Exchange are a little different than what you see in a client like Outlook. 通过 Exchange 中的 EWS，可以执行创建、存储、发送或更改信息等操作，而不是显示信息。Instead of displaying information, EWS in Exchange enables you to do things like create, store, send, or change information. 若要使用 EWS 处理日历，您需要熟悉诸如信息存储、时间、定期和邮件流等概念。To use EWS to work with calendars, you'll need to be familiar with concepts such as information storage, time, recurrence, and message flow. 更具体地说，您需要熟悉以下内容：More specifically, you'll need to be familiar with the following:
日历文件夹、日历项目和日历视图Calendar folders, calendar items, and calendar views
会议请求、响应、日程安排、与会者、资源、会议室和可用性Meeting requests, responses, scheduling, attendees, resources, rooms, and availability
会议和约会的持续时间、时区以及开始和结束时间Time durations, time zones, and start and end times of meetings and appointments
定期系列、定期模式、异常和单个实例约会和会议Recurring series, recurrence patterns, exceptions, and single instance appointments and meetings
幸运的是，EWS 和 EWS 托管 API 提供了一组丰富的操作和方法，使您能够执行大量与日历相关的任务。Fortunately, EWS and the EWS Managed API provide a rich set of operations and methods that enable you to perform a wide range of calendar-related tasks. 例如，使用 EWS 托管 API，您可以创建会议并只向与会者发送邀请，只需几行代码，如下面的示例所示。For example, using the EWS Managed API, you can create a meeting and send invitations to attendees with just a few lines of code, as shown in the following example.
Appointment meeting = new Appointment(service); // Set the properties on the meeting object to create the meeting. meeting.Subject = "Team building exercise"; meeting.Body = "Let's learn to really work as a team and then have lunch!"; meeting.Start = DateTime.Now.AddDays(2); meeting.End = meeting.Start.AddHours(2); meeting.Location = "Conference Room 12"; meeting.RequiredAttendees.Add("Mack.Chaves@contoso.com"); meeting.RequiredAttendees.Add("Sadie.Daniels@contoso.com"); meeting.OptionalAttendees.Add("Magdalena.Kemp@contoso.com"); meeting.ReminderMinutesBeforeStart = 60; // Send the meeting request meeting.Save(SendInvitationsMode.SendToAllAndSaveCopy);
日历文件夹和日历项目Calendar folders and calendar items
"日历" 文件夹包含日历项目。Calendar folders contain calendar items. "日历" 文件夹的folder 类为IPF。约会，并且可以仅包括由ItemClass EWS 托管 API 属性（与约会类对象或 EWS CalendarItemType元素相关联）定义的项目。Calendar folders have a folder class of IPF.Appointment, and can include only the items defined by the ItemClass EWS Managed API property, which is associated with an Appointment Class object, or the EWS CalendarItemType element.
"日历" 文件夹中的项目与邮箱中的其他文件夹中的项目略有不同，因为定期系列中的事件和定期系列的例外不是邮箱中的实际项目，而是作为定期母版的附件在内部存储。Items in a Calendar folder are a little different from items in other folders in a mailbox because occurrences in a recurring series and exceptions to a recurring series are not actual items in the mailbox, but rather are stored internally as attachments to a recurring master. 因此，为了检索给定日期范围内的所有约会，您需要使用日历视图。Therefore, in order to retrieve all appointments in a given date range, you need to use a calendar view. 若要了解有关检索约会和日历视图的详细信息，请参阅使用 Exchange 中的 EWS 获取约会和会议。To learn more about retrieving appointments and calendar views, see Get appointments and meetings by using EWS in Exchange.
会议和约会Meetings and appointments
会议和约会之间的基本区别在于会议具有与会者，而约会则不是。The essential difference between meetings and appointments is that meetings have attendees, and appointments don't. 在内部，Exchange 对会议和约会使用相同的对象。Internally, Exchange uses the same object for both meetings and appointments. 您可以使用 EWS 托管 API约会类或 ews CalendarItem元素来处理会议和约会。You use the EWS Managed API Appointment class or the EWS CalendarItem element to work with meetings and appointments.
约会和会议既可以是单个实例，也可以是定期系列的一部分，但由于约会不包括与会者、会议室或资源，因此它们不需要发送邮件。Both appointments and meetings can be single instances or part of a recurring series, but because appointments don't include attendees, rooms, or resources, they do not require a message to be sent.
由于会议包括发送和响应请求和更新，因此他们不仅仅涉及访问 "日历" 文件夹中的项目。Because meetings include sending and responding to requests and updates, they involve more than just accessing items in a Calendar folder. 它们还具有关联的工作流。They also have an associated workflow. 会议必须在与会者可用时安排日程，还可以涉及保留会议室或诸如投影仪或其他设备等资源。Meetings must be scheduled when attendees are available, and can also involve reserving a meeting room, or resources such as a projector or other equipment.
会议工作流通常涉及以下步骤：The meeting workflow typically involves the following steps:
创建一个会议并使用诸如开始和结束时间、位置和邮件正文的信息填充。A meeting is created and populated with information such as start and end time, location, and a message body.
将创建一个预期的与会者、资源和聊天室的列表。A list of prospective attendees, resources, and rooms is created.
检查与会者的可用性状态。The availability status of attendees is checked.
向与会者发送会议请求。A meeting request is sent to attendees.
与会者回复会议时，他们想要参加会议。Attendees reply to the meeting with their intention to attend or not. 与会者还可能为会议建议新时间。Attendees may also propose a new time for the meeting.
可以取消或更新会议，这通常会触发要发送给与会者的新邮件。Meetings can be canceled or updated, which typically trigger new messages to be sent to attendees.
日历和时间Calendars and time
与时间相关的功能是日历不可或缺的。Time-related functionality is integral to calendaring. 约会和会议具有开始和结束时间、持续时间和其他与时间相关的属性，例如创建、发送和接收邮件的时间。Appointments and meetings have start and end times, durations, and other time-related properties, such as the time at which a message is created, sent, and received. 可以基于开始时间和结束时间从 "日历" 文件夹中检索现有约会和会议。Existing appointments and meetings can be retrieved from a Calendar folder based on a start and end time. 定期系列具有开头和结尾。Recurring series have beginnings and ends. 和会议在给定时区内发生，这在全球经济中越来越重要。And meetings occur within a given time zone, which is increasingly important in a global economy.
时间以协调世界时（UTC）的形式存储在 Exchange 服务器内部。Times are stored internally on an Exchange server in Coordinated Universal Time (UTC). Exchange 将根据客户端设置将它们转换为本地时区。Exchange converts them to local time zone based on client settings. DateTime属性的作用范围限定为计算机的本地时区。DateTime properties are scoped to the computer's local time zone.
定期的约会或会议系列由一个定期的主控形状、一组发生项以及一组异常项组成。A recurring series of appointments or meetings is comprised of a recurring master, a set of occurrence items, and optionally, a set of exception items. 定期信息存储在定期主项目上。Recurrence information is stored on the recurring master item. RecurringMasterItemId ews 元素与系列中的匹配项和异常相关联，也可以使用BINDTORECURRINGMASTER EWS 托管 API 方法来获取定期母版。The RecurringMasterItemId EWS element is associated with occurrences and exceptions in a series, or you can use the Appointment.BindToRecurringMaster EWS Managed API method to get the recurring master. 使用系列的实例，可以查找与系列关联的所有元素和信息。Using an instance of a series, you can find all the elements and information associated with the series.
请注意，所有日历项目上都存在定期属性，但它们只是在定期的主项目上进行填充。Note that recurrence properties exist on all calendar items, but they are populated only on recurring master items. 除了一个系列中的所有匹配项的索引，该定期主控形状具有对修改和删除的匹配项以及系列的定期模式（例如，每天、每周、每月或每年）的引用。In addition to an index of all occurrences in a series, the recurring master has a reference to modified and deleted occurrences and the recurrence pattern of a series (for example, daily, weekly, monthly, or yearly).