> For the complete documentation index, see [llms.txt](https://4wsplatform.gitbook.io/user-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://4wsplatform.gitbook.io/user-guide/modules/gsuite/ee5-google-calendar.md).

# Calendar

With this integration developers can automate the creation and management of calendar events in the user’s main calendar. This feature is not intended for Google Calendar UI substitution, but for basic and automatic operations: creation, update and deletion of an event.\
In order to use this feature, you have also to define a few parameters in 4WS.Platform:

* GOOGLE\_SERVACC\_EMAIL
* GOOGLE\_SERVACC\_KEY

to enable the Google Apps integration and the 4WS.Platform user must be a Google Apps user.\
The Javascript actions available are the following.

## Add a calendar event in the main calendar of a Google Apps for Work Account

### Syntax

```javascript
utils.addGoogleCalendarEvent(title, beginDate, endDate)
```

### Details

**title** – the title of the event\
**beginDate** – the beginning date and time of the event\
**endDate** – the ending date time of the event

### Example

this example shows how to call the method from a Javascript Server action and get the id of the event. The full list of fields can be found in the Java org.wag.valueobjects.java.CalendarEvent class.

```javascript
var cal = utils.addGoogleCalendarEvent('My new event', new Date(2014,8,26,11,00), new Date(2014,8,26,12,00));
utils.setReturnValue('{ "id":"' + cal.id +'" }');
```

After this we can for example use a JDBC call to save the id in a DB.\
If the return value of the server call is needed on the client side, a Javascript client call can be set up to get the JSON object representing, in this case, the id (the actionId is the id of the Javascript Server action):

```javascript
var response = new SyncRequest().send(
    contextPath+"/executeJs?applicationId=&lt;appId&gt;" +
    "&amp;actionId=&lt;actionId&gt;",
    "POST",
    null
);
alert(response);
```

## Modify a calendar event

### Syntax

```javascript
utils.modifyGoogleCalendarEvent(calendarEventId, title, beginDate, endDate)
```

### Details

**calendarEventId** – the id of the event\
**title** – the title of the event\
**beginDate** – the beginning date and time of the event\
**endDate** – the ending date time of the event

### Example

modify the title of an event

```javascript
utils.modifyGoogleCalendarEvent('','Modyfied title',null,null);
```

## Delete a Google Apps calendar event

### Syntax

```javascript
utils.deleteGoogleCalendarEvent(calendarEventId)
```

### Details

**calendarEventId** – the id of the event


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://4wsplatform.gitbook.io/user-guide/modules/gsuite/ee5-google-calendar.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
