--- sidebar_position: 2 description: Create calendar and other functions to work with Bitrix24 in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, Bitrix24] --- import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; # Create calendar Creates a new calendar `Function CreateCalendar(Val URL, Val FieldsStructure, Val Token = "") Export` | Parameter | CLI option | Type | Required | Description | |-|-|-|-|-| | URL | --url | String | ✔ | URL of webhook or a Bitrix24 domain, when token used | | FieldsStructure | --fields | Structure Of KeyAndValue | ✔ | Calendar fields structure (see GetCalendarStructure) | | Token | --token | String | ✖ | Access 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](https://apidocs.bitrix24.ru/api-reference/calendar/calendar-section-add.html) :::
```bsl title="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 = "4f8db968006e9f06006b12e400000001000..."; Result = OPI_Bitrix24.CreateCalendar(URL, CalendarsStructure, Token); ``` ```bash # 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 "***" ``` ```batch :: 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 "***" ``` ```json title="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 } } ```