1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2024-12-29 02:57:35 +02:00
OpenIntegrations/docs/en/md/Google_Calendar/Event-management/Create-event.md
2024-06-04 21:55:01 +03:00

100 lines
2.6 KiB
Markdown

---
sidebar_position: 4
---
# Create event
Creates a new event
*Function CreateEvent(Val Token, Val Calendar, Val EventDescription) ExportReturn EventManagement(Token, Calendar, EventDescription);EndFunction*
| Parameter | CLI option | Type | Destination |
|-|-|-|-|
| Token | --token | String | Token |
| Calendar | --calendar | String | Calendar ID |
| EventDescription | --props | Key-Value Pair | Event description |
Returns: String, Arbitrary, HTTPResponse, BinaryData, Undefined - Google server response
```bsl title="Code example"
Attachments = New Map;
Attachments.Insert("Image1", "https://opi.neocities.org/assets/images/logo_long-e8fdcca6ff8b32e679ea49a1ccdd3eac.png");
Attachments.Insert("Image2", "https://github.com/Bayselonarrend/OpenIntegrations/raw/main/Media/logo.png?v1");
EventMatch = New Map;
EventMatch.Insert("Description", Description);
EventMatch.Insert("Title", Name);
EventMatch.Insert("Venue", "On office");
EventMatch.Insert("StartDate", CurrentSessionDate());
EventMatch.Insert("EndDate", EventMatch["StartDate"] + 3600);
EventMatch.Insert("ArrayOfAttachmentURLs", Attachments);
EventMatch.Insert("SendNotifications", True);
Response = OPI_GoogleCalendar.CreateEvent(Token, Calendar, EventMatch);
Response = OPI_Tools.JSONString(Response);
```
```sh title="CLI command example"
oint gcalendar CreateEvent --token %token% --calendar %calendar% --props %props%
```
```json title="Result"
{
"eventType": "default",
"attachments": [
{
"iconLink": "",
"title": "Image2",
"fileUrl": "https://github.com/Bayselonarrend/OpenIntegrations/raw/main/Media/logo.png?v1"
},
{
"iconLink": "",
"title": "Image1",
"fileUrl": "https://opi.neocities.org/assets/images/logo_long-e8fdcca6ff8b32e679ea49a1ccdd3eac.png"
}
],
"reminders": {
"useDefault": true
},
"sequence": 0,
"start": {
"timeZone": "Europe/Minsk",
"dateTime": "2024-02-21T15:16:25+03:00"
},
"creator": {
"self": true,
"email": "bayselonarrend@gmail.com"
},
"end": {
"timeZone": "Europe/Minsk",
"dateTime": "2024-02-21T16:16:25+03:00"
},
"iCalUID": "j4nonfcc0m2mtop1vc8ivo8tb8@google.com",
"description": "TestEventDescription",
"updated": "2024-02-21T09:16:28.474Z",
"created": "2024-02-21T09:16:28.000Z",
"htmlLink": "https://www.google.com/calendar/event?eid=ajRub25mY2MwbTJtdG9wMXZjOGl2bzh0YjggYmF5c2Vsb25hcnJlbmRAbQ",
"location": "On office",
"summary": "New event",
"organizer": {
"self": true,
"email": "bayselonarrend@gmail.com"
},
"status": "confirmed",
"id": "j4nonfcc0m2mtop1vc8ivo8tb8",
"etag": "\"3417013976948000\"",
"kind": "calendar#event"
}
```