Skip to main content

Create calendar

Creates a new calendar

Function CreateCalendar(Val URL, Val FieldsStructure, Val Token = "") Export

ParameterCLI optionTypeRequiredDescription
URL--urlStringURL of webhook or a Bitrix24 domain, when token used
FieldsStructure--fieldsStructure Of KeyAndValueCalendar fields structure (see GetCalendarStructure)
Token--tokenStringAccess token, when app auth method used

Returns: Map Of KeyAndValue - serialized JSON of answer from Bitrix24 API


tip

Method at API documentation: calendar.section.add


1C:Enterprise/OneScript code example
    UserID = 1;

CalendarsStructure = New Structure;
CalendarsStructure.Insert("type" , "user");
CalendarsStructure.Insert("ownerId" , UserID);
CalendarsStructure.Insert("name" , "new calendar");
CalendarsStructure.Insert("description", "My new calendar");
CalendarsStructure.Insert("color" , "#FFFFFF");
CalendarsStructure.Insert("text_color" , "#000000");

ExportStructure = New Structure;
ExportStructure.Insert("ALLOW", "True");
ExportStructure.Insert("SET" , "all");

CalendarsStructure.Insert("export", ExportStructure);

URL = "https://b24-ar17wx.bitrix24.by/rest/1/h0m...";

Result = OPI_Bitrix24.CreateCalendar(URL, CalendarsStructure);

CalendarsStructure.Insert("name" , "Another calendar");
CalendarsStructure.Insert("description", "My other new calendar");

URL = "b24-ar17wx.bitrix24.by";
Token = "8536b467006e9f06006b12e400000001000...";

Result = OPI_Bitrix24.CreateCalendar(URL, CalendarsStructure, Token);
    # JSON data can also be passed as a path to a .json file

oint bitrix24 CreateCalendar \
--url "b24-ar17wx.bitrix24.by" \
--fields "{'type':'user','ownerId':1,'name':'Another calendar','description':'My other new calendar','color':'#FFFFFF','text_color':'#000000','export':{'ALLOW':'True','SET':'all'}}" \
--token "***"
Result
{
"result": 80,
"time": {
"start": 1737396240.60307,
"finish": 1737396240.65016,
"duration": 0.0470879077911377,
"processing": 0.0163719654083252,
"date_start": "2025-01-20T21:04:00+03:00",
"date_finish": "2025-01-20T21:04:00+03:00",
"operating_reset_at": 1737396840,
"operating": 0
}
}