You've already forked OpenIntegrations
mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2025-11-29 22:27:42 +02:00
148 lines
6.0 KiB
Plaintext
Vendored
148 lines
6.0 KiB
Plaintext
Vendored
---
|
|
sidebar_position: 1
|
|
description: Create calendar event 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 event
|
|
Creates a new calendar event
|
|
|
|
|
|
|
|
`Function CreateCalendarEvent(Val URL, Val EventDescription, Val Token = "") Export`
|
|
|
|
| Parameter | CLI option | Type | Required | Description |
|
|
|-|-|-|-|-|
|
|
| URL | --url | String | ✔ | URL of webhook or a Bitrix24 domain, when token used |
|
|
| EventDescription | --fields | Structure Of KeyAndValue | ✔ | Event description. See GetCalendarEventsStructure |
|
|
| Token | --token | String | ✖ | Access token, when app auth method used |
|
|
|
|
|
|
Returns: Map Of KeyAndValue - serialized JSON of answer from Bitrix24 API
|
|
|
|
<br/>
|
|
|
|
:::tip
|
|
Method at API documentation: [calendar.event.add](https://apidocs.bitrix24.ru/api-reference/calendar/calendar-event/calendar-event-add.html)
|
|
:::
|
|
<br/>
|
|
|
|
|
|
```bsl title="1C:Enterprise/OneScript code example"
|
|
URL = "https://b24-ar17wx.bitrix24.by/rest/1/h0m...";
|
|
CalendarID = "1502";
|
|
|
|
Tomorrow = OPI_Tools.GetCurrentDate() + 86400;
|
|
Hour = 3600;
|
|
|
|
EventStucture = New Structure;
|
|
|
|
EventStucture.Insert("type" , "user");
|
|
EventStucture.Insert("ownerId" , 1);
|
|
EventStucture.Insert("from" , XMLString(Tomorrow));
|
|
EventStucture.Insert("to" , XMLString(Tomorrow + Hour));
|
|
EventStucture.Insert("section" , CalendarID);
|
|
EventStucture.Insert("name" , "New event");
|
|
EventStucture.Insert("skip_time" , "N");
|
|
EventStucture.Insert("timezone_from", "Europe/Minsk");
|
|
EventStucture.Insert("timezone_to" , "Europe/Minsk");
|
|
EventStucture.Insert("description" , "Event description");
|
|
EventStucture.Insert("color" , "%23000000>");
|
|
EventStucture.Insert("text_color" , "%23FFFFFF");
|
|
EventStucture.Insert("accessibility", "quest");
|
|
EventStucture.Insert("importance" , "normal");
|
|
EventStucture.Insert("private_event", "Y");
|
|
|
|
RepeatabilityStructure = New Structure;
|
|
RepeatabilityStructure.Insert("FREQ" , "DAILY");
|
|
RepeatabilityStructure.Insert("COUNT" , 3);
|
|
RepeatabilityStructure.Insert("INTERVAL", 10);
|
|
|
|
DaysArray = New Array;
|
|
DaysArray.Add("SA");
|
|
DaysArray.Add("MO");
|
|
|
|
RepeatabilityStructure.Insert("BYDAY", DaysArray);
|
|
RepeatabilityStructure.Insert("UNTIL", XMLString(Tomorrow + Hour * 24 * 10));
|
|
|
|
EventStucture.Insert("rrule" , RepeatabilityStructure);
|
|
EventStucture.Insert("is_meeting", "Y");
|
|
EventStucture.Insert("location" , "Office");
|
|
|
|
RemindersArray = New Array;
|
|
|
|
ReminderStructure = New Structure;
|
|
ReminderStructure.Insert("type" , "day");
|
|
ReminderStructure.Insert("count", 1);
|
|
|
|
RemindersArray.Add(ReminderStructure);
|
|
|
|
EventStucture.Insert("remind" , RemindersArray);
|
|
EventStucture.Insert("attendees", StrSplit("1,10", ","));
|
|
EventStucture.Insert("host" , 1);
|
|
|
|
MeetingStructure = New Structure;
|
|
MeetingStructure.Insert("notify" , "Y");
|
|
MeetingStructure.Insert("reinvite" , "Y");
|
|
MeetingStructure.Insert("allow_invite", "N");
|
|
MeetingStructure.Insert("hide_guests" , "N");
|
|
|
|
EventStucture.Insert("meeting", MeetingStructure);
|
|
|
|
Result = OPI_Bitrix24.CreateCalendarEvent(URL, EventStucture);
|
|
|
|
URL = "b24-ar17wx.bitrix24.by";
|
|
Token = "8a1bee68006e9f06006b12e400000001000...";
|
|
CalendarID = "1504";
|
|
|
|
EventStucture.Insert("section", CalendarID);
|
|
|
|
Result = OPI_Bitrix24.CreateCalendarEvent(URL, EventStucture, Token);
|
|
```
|
|
|
|
|
|
<Tabs>
|
|
|
|
<TabItem value="bash" label="Bash" default>
|
|
```bash
|
|
# JSON data can also be passed as a path to a .json file
|
|
|
|
oint bitrix24 CreateCalendarEvent \
|
|
--url "b24-ar17wx.bitrix24.by" \
|
|
--fields "{'type':'user','ownerId':'1','from':'10/16/2025 10:04:23','to':'10/16/2025 11:04:23','section':'1524','name':'New event','skip_time':'N','timezone_from':'Europe/Minsk','timezone_to':'Europe/Minsk','description':'Event description','color':'%23000000>','text_color':'%23FFFFFF','accessibility':'quest','importance':'normal','private_event':'Y','rrule':{'FREQ':'DAILY','COUNT':'3','INTERVAL':'10','BYDAY':['SA','MO'],'UNTIL':'10/26/2025 10:04:23'},'is_meeting':'Y','location':'Office','remind':[{'type':'day','count':'1'}],'attendees':['1','10'],'host':'1','meeting':{'notify':'Y','reinvite':'Y','allow_invite':'N','hide_guests':'N'}}" \
|
|
--token "***"
|
|
```
|
|
</TabItem>
|
|
|
|
<TabItem value="bat" label="CMD/Bat" default>
|
|
```batch
|
|
:: JSON data can also be passed as a path to a .json file
|
|
|
|
oint bitrix24 CreateCalendarEvent ^
|
|
--url "b24-ar17wx.bitrix24.by" ^
|
|
--fields "{'type':'user','ownerId':'1','from':'10/16/2025 10:04:23','to':'10/16/2025 11:04:23','section':'1524','name':'New event','skip_time':'N','timezone_from':'Europe/Minsk','timezone_to':'Europe/Minsk','description':'Event description','color':'%23000000>','text_color':'%23FFFFFF','accessibility':'quest','importance':'normal','private_event':'Y','rrule':{'FREQ':'DAILY','COUNT':'3','INTERVAL':'10','BYDAY':['SA','MO'],'UNTIL':'10/26/2025 10:04:23'},'is_meeting':'Y','location':'Office','remind':[{'type':'day','count':'1'}],'attendees':['1','10'],'host':'1','meeting':{'notify':'Y','reinvite':'Y','allow_invite':'N','hide_guests':'N'}}" ^
|
|
--token "***"
|
|
```
|
|
</TabItem>
|
|
</Tabs>
|
|
|
|
|
|
```json title="Result"
|
|
{
|
|
"result": 2792,
|
|
"time": {
|
|
"start": 1760522669,
|
|
"finish": 1760522669.66098,
|
|
"duration": 0.660979986190796,
|
|
"processing": 0,
|
|
"date_start": "2025-10-15T10:04:29+00:00",
|
|
"date_finish": "2025-10-15T10:04:29+00:00",
|
|
"operating_reset_at": 1760523269,
|
|
"operating": 0.348024845123291
|
|
}
|
|
}
|
|
```
|