Skip to main content

Create event

Creates a new event

Function CreateEvent(Val Token, Val Calendar, Val EventDescription) Export

ParameterCLI optionTypeRequiredDescription
Token--tokenStringToken
Calendar--calendarStringCalendar ID
EventDescription--propsMap Of KeyAndValueEvent description

Returns: String, Arbitrary, HTTPResponse, BinaryData, Undefined - Google server response


1C:Enterprise/OneScript code example
    CurrentDate = OPI_Tools.GetCurrentDate();
Token = "ya29.a0AS3H6Nw6rTG3pFXv17ZLXkvuvtNl_DHHXbxe2yDRIB09Sq-BA7xPQj9V7OKAaAiHRZAsVqI0UD6026Q_3gklXjU-kam0kzFCe2adXI3lS...";
Calendar = "b4cd7b78fa45f2448bc045fe33639a9322a4851ff48d6eaa6dfbc2f95a6410d5@group.calendar.google.com";
Name = "New event";
Description = "TestEventDescription";
Hour = 3600;

Image1 = "https://hut.openintegrations.dev/test_data/picture.jpg"; // URL, Binary or File path
Image2 = "https://hut.openintegrations.dev/test_data/picture2.jpg"; // URL, Binary or File path
Attachments = New Map;

Attachments.Insert("Image1", Image1);
Attachments.Insert("Image2", Image2);

EventDescription = New Map;
EventDescription.Insert("Description" , Description);
EventDescription.Insert("Title" , Name);
EventDescription.Insert("Venue" , "InOffice");
EventDescription.Insert("StartDate" , CurrentDate);
EventDescription.Insert("EndDate" , EventDescription["StartDate"] + Hour);
EventDescription.Insert("ArrayOfAttachmentURLs", Attachments);
EventDescription.Insert("SendNotifications" , True);

Result = OPI_GoogleCalendar.CreateEvent(Token, Calendar, EventDescription);
    # JSON data can also be passed as a path to a .json file

oint gcalendar CreateEvent \
--token "***" \
--calendar "71f75db8bf9c75c25f264964b3af33cf6d655047017e7bc54cf74ab33dc9b704@group.calendar.google.com" \
--props "{'Description':'TestEventDescription','Title':'New event','Venue':'InOffice','StartDate':'2025-07-15T17:13:04.7271347Z','EndDate':'2025-07-15T18:13:04.7271347Z','ArrayOfAttachmentURLs':{'Image1':'https://hut.openintegrations.dev/test_data/picture.jpg','Image2':'https://hut.openintegrations.dev/test_data/picture2.jpg'},'SendNotifications':true}"
Result
{
"kind": "calendar#event",
"etag": "\"3456908679760000\"",
"id": "7rfbn0fb8nai4i7v4l435tgl1c",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=N3JmYm4wZmI4bmFpNGk3djRsNDM1dGdsMWMgNjA2MTNkNTNjNDY3MGFiZGNlZWMzZTc2OTNjYTQ3NWIwZTg4ZGMxNjc4ZGI3MjEwNTIxMzU2YjQ5NDBhNjE0OEBn",
"created": "2024-10-09T06:12:19Z",
"updated": "2024-10-09T06:12:19.88Z",
"summary": "New event",
"description": "TestEventDescription",
"location": "InOffice",
"creator": {
"email": "bayselonarrend@gmail.com"
},
"organizer": {
"email": "60613d53c4670abdceec3e7693ca475b0e88dc1678db7210521356b4940a6148@group.calendar.google.com",
"displayName": "TestCalendar",
"self": true
},
"start": {
"dateTime": "2024-10-09T12:12:19+03:00",
"timeZone": "Europe/Moscow"
},
"end": {
"dateTime": "2024-10-09T13:12:19+03:00",
"timeZone": "Europe/Moscow"
},
"iCalUID": "7rfbn0fb8nai4i7v4l435tgl1c@google.com",
"sequence": 0,
"reminders": {
"useDefault": true
},
"attachments": [
{
"fileUrl": "https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/picture.jpg",
"title": "Image1",
"iconLink": ""
},
{
"fileUrl": "https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/picture2.jpg",
"title": "Image2",
"iconLink": ""
}
],
"eventType": "default"
}