1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-12-05 22:53:35 +02:00
Files
OpenIntegrations/docs/en/md/Bitrix24/Calendar-events-management/Create-calendar-event.mdx

147 lines
5.8 KiB
Plaintext
Raw Normal View History

2025-01-26 13:33:10 +03:00
---
sidebar_position: 1
---
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...";
2025-02-18 14:08:09 +03:00
CalendarID = "362";
2025-01-26 13:33:10 +03:00
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");
2025-02-07 21:02:23 +03:00
EventStucture.Insert("accessibility", "quest");
EventStucture.Insert("importance" , "normal");
EventStucture.Insert("private_event", "Y");
2025-01-26 13:33:10 +03:00
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";
2025-02-18 14:08:09 +03:00
Token = "8536b467006e9f06006b12e400000001000...";
CalendarID = "364";
2025-01-26 13:33:10 +03:00
EventStucture.Insert("section", CalendarID);
Result = OPI_Bitrix24.CreateCalendarEvent(URL, EventStucture, Token);
```
2025-02-10 12:36:30 +03:00
<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" \
2025-02-19 16:19:57 +03:00
--fields "{'type':'user','ownerId':1,'from':'2025-02-20T09:23:27.7497356','to':'2025-02-20T10:23:27.7497356','section':404,'name':'New event','skip_time':'N','timezone_from':'Europe/Minsk','timezone_to':'Europe/Minsk','description':'Event description','color':'%23000000>','text_color':'%23FFFFFF','accessibility':'busy','importance':'high','private_event':'N','rrule':{'FREQ':'DAILY','COUNT':3,'INTERVAL':10,'BYDAY':['SA','MO'],'UNTIL':'2025-03-02T09:23:27.7497356'},'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'}}" \
2025-02-10 12:36:30 +03:00
--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" ^
2025-02-19 16:19:57 +03:00
--fields "{'type':'user','ownerId':1,'from':'2025-02-20T09:23:27.7497356','to':'2025-02-20T10:23:27.7497356','section':404,'name':'New event','skip_time':'N','timezone_from':'Europe/Minsk','timezone_to':'Europe/Minsk','description':'Event description','color':'%23000000>','text_color':'%23FFFFFF','accessibility':'busy','importance':'high','private_event':'N','rrule':{'FREQ':'DAILY','COUNT':3,'INTERVAL':10,'BYDAY':['SA','MO'],'UNTIL':'2025-03-02T09:23:27.7497356'},'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'}}" ^
2025-02-10 12:36:30 +03:00
--token "***"
```
</TabItem>
</Tabs>
2025-01-26 13:33:10 +03:00
2025-02-09 18:15:36 +03:00
```json title="Result"
{
"result": 306,
"time": {
"start": 1739051124.1171,
"finish": 1739051124.33063,
"duration": 0.213531017303467,
"processing": 0.188530921936035,
"date_start": "2025-02-09T00:45:24+03:00",
"date_finish": "2025-02-09T00:45:24+03:00",
"operating_reset_at": 1739051724,
"operating": 0.18851113319397
}
}
```