• Модуль: calendar
  • Путь к файлу: ~/bitrix/modules/calendar/classes/general/calendar.php
  • Класс: CCalendar
  • Вызов: CCalendar::SaveSection
static function SaveSection($params)
{
	$type = $params['arFields']['CAL_TYPE'] ?? self::$type;

	// Exchange
	if (($params['bAffectToDav'] ?? null) !== false && $type === 'user' && self::IsExchangeEnabled(self::$ownerId))
	{
		$exchRes = true;
		$ownerId = $params['arFields']['OWNER_ID'] ?? self::$ownerId;

		if ($params['arFields']['IS_EXCHANGE'])
		{
			$exchRes = CDavExchangeCalendar::DoAddCalendar($ownerId, $params['arFields']);
		}

		if ($exchRes !== true)
		{
			if (!is_array($exchRes) || !isset($exchRes['XML_ID']))
			{
				return self::ThrowError(self::CollectExchangeErrors($exchRes));
			}

			// // It's ok, we successfuly save event to exchange calendar - and save it to DB
			$params['arFields']['DAV_EXCH_CAL'] = $exchRes['XML_ID'];
			$params['arFields']['DAV_EXCH_MOD'] = $exchRes['MODIFICATION_LABEL'];
		}
	}

	// Save here
	$id = (int)CCalendarSect::Edit($params);
	self::ClearCache(['section_list', 'event_list']);

	return $id;
}