• Модуль: calendar
  • Путь к файлу: ~/bitrix/modules/calendar/lib/sharing/sharingeventmanager.php
  • Класс: BitrixCalendarSharingSharingEventManager
  • Вызов: SharingEventManager::getSectionId
static function getSectionId($userId)
{
	$result = CCalendarSect::GetList([
		'arFilter' => [
			'OWNER_ID' => $userId,
			'CAL_TYPE' => 'user',
			'ACTIVE' => 'Y'
		]
	]);

	if (!$result)
	{
		$createdSection = CCalendarSect::CreateDefault([
			'type' => 'user',
			'ownerId' => $userId,
		]);
		$result[] = $createdSection;
	}

	return $result[0]['ID'];
}