Google GSuite
Google Calendar - adding an event
Adding an event to Google Calendar.
Syntax:
Description:
Argument | Description |
title | Event title |
beginDate | starting date+time |
endDate | ending date+time |
This event is created for the calendar associated to the current logged user.
The resulting javascript object has the following structure:
where "attendees" is a list of people invited to the event; each javascript object in this list has the following structure:
Google Calendar - adding an event with more customizations
Adding an event to Google Calendar.
Syntax:
Description:
Argument | Description |
title | Event title |
beginDate | starting date+time |
endDate | ending date+time |
description | additional description to include in the event |
location | can be null; it can be a complete address or a city, a province, etc. |
calendarId | can be null; if not filled, the default calendar for the current logged user will be used; if set, it is the calendar id where creating the event; the current admin user must have grants to save data into that calendar:; in order to retrieve the calendar id, go to Google Calendar, right click on the calendar on the list on the left and choose "Settings and sharing"; finally, search for "Calendar ID". |
creatorEmail | can be null; if not filled, the current logged user email will be used; if set, this will be the owner of the event (if the specified email address in owner of the specified calendar) |
attendesEmails | a Javascript array containing a list of email addresses, representing people invited to the event |
This event is created for the calendar associated to the specified user/calendar.
The resulting javascript object has the following structure:
where "attendees" is a list of people invited to the event; each javascript object in this list has the following structure:
Google Calendar - adding an event with conference
Adding an event to Google Calendar with a conference linked to it. A conference can be:
Hangouts for consumers (http://hangouts.google.com)
Classic Hangouts for G Suite users (http://hangouts.google.com)
Google Meet (http://meet.google.com)
"addOn" for 3P conference providers
Syntax:
Description:
Argument | Description |
title | Event title |
beginDate | starting date+time |
endDate | ending date+time |
description | additional description to include in the event |
location | can be null; it can be a complete address or a city, a province, etc. |
calendarId | can be null; if not filled, the default calendar for the current logged user will be used; if set, it is the calendar id where creating the event; the current admin user must have grants to save data into that calendar:; in order to retrieve the calendar id, go to Google Calendar, right click on the calendar on the list on the left and choose "Settings and sharing"; finally, search for "Calendar ID". |
type | link to the event a conference; allowed values are:
|
creatorEmail | can be null; if not filled, the current logged user email will be used; if set, this will be the owner of the event (if the specified email address in owner of the specified calendar) |
attendesEmails | a Javascript array containing a list of email addresses, representing people invited to the event |
This event is created for the calendar associated to the specified user/calendar.
The resulting javascript object has the following structure:
where "attendees" is a list of people invited to the event; each javascript object in this list has the following structure:
Google Calendar - modifying an event
Change the event title or timing for a Google Calendar event.
Syntax:
Description:
Argument | Description |
calendarEventId | the event id, which is defined when an event is created the first time and available in the "calendar event" js object returned by the previous method. |
title | event title |
beginDate | starting date+time |
endDate | ending date+time |
This event is changed in the calendar associated to the current logged user.
Google Calendar - deleting an event
Delete and already existing event in the Google Calendar.
Syntax:
Description:
Argument | Description |
calendarEventId | the event id, which is defined when an event is created the first time and available in the "calendar event" js object returned by the previous method. |
This event is removed from the calendar associated to the current logged user.
Google Drive - create a folder
Syntax:
Description:
Argument | Description |
userId | optional username; if not specified, the userEmail value set as application property for Google service account will be used as owner for this folder. If this argument is defined, the folder owner will be this user. |
folderName | folder name |
parents | list of folder parents: the list of folders from the root must be specified |
description | optional folder description |
The method returns a javascript object having the following structure:
The "id" value represents a unique identifier for the folder and can be used later to manage it (rename, delete, etc.)
Google Drive - delete a file or folder
Syntax:
Description:
Argument | Description |
userId | optional username; if not specified, the userEmail value set as application property for Google service account will be used as owner for this folder. If this argument is defined, the folder owner will be this user. |
fileId | folder identifier (it is the "id" attribute of the js object returned by the previous method) |
skipTrash | boolean flag used to define how a folder deletion will be managed: true to permanently delete the folder; false to mark the folder as deleted and moved to the special "trash" folder (in such a case, it can be restored). |
Google Drive - add permissions to folder
Syntax:
Description:
Argument | Description |
userId | optional username; if not specified, the userEmail value set as application property for Google service account will be used as owner for this folder. If this argument is defined, the folder owner will be this user. |
folderId | folder id; permissions will be set for this folder and maybe to subfolders as well, according to the "recursive" boolean flag |
type | the type of sharing, one between “user”, “group”, “domain” or “default” |
value | the email of the user/group or the domain name |
fileRole | the role for files, one of “reader”, “writer” or “owner” |
folderRole | the role for folders, one of “reader”, “writer” or “owner |
additionalRoles | list of additional roles; optional string, for example [“commenter”] |
updateBaseFolder | boolean flag; if true applies permissions to the base folder identified by folderId |
recursive | boolean flag: if set to true, apply the specified permissions to all subfolders as well |
sendNotifications | boolean flag; if set to true, an email message will be sent to all destinations; the email message is defined through the next argument |
message | email notification message |
Google Drive - set permissions to file
Syntax:
Description:
Argument | Description |
userId | optional username; if not specified, the userEmail value set as application property for Google service account will be used as owner for this folder. If this argument is defined, the folder owner will be this user. |
fileId | file id |
type | the type of sharing, one between “user”, “group”, “domain” or “default” |
value | the email of the user/group or the domain name |
role | the role for files, one of “reader”, “writer” or “owner” |
additionalRoles | list of additional roles; optional string, for example [“commenter”] |
updateBaseFolder | boolean flag; if true applies permissions to the base folder identified by folderId |
sendNotifications | boolean flag; if set to true, an email message will be sent to all destinations; the email message is defined through the next argument |
message | email notification message |
Google Drive - set property to a file
Syntax:
Description:
Argument | Description |
userId | optional username; if not specified, the userEmail value set as application property for Google service account will be used as owner for this folder. If this argument is defined, the folder owner will be this user. |
fileId | file identifier |
key | property identifier |
value | property value |
visibility | allowed values: "PRIVATE" or "PUBLIC" |
Google Drive - remove a property from a file
Syntax:
Description:
Argument | Description |
userId | optional username; if not specified, the userEmail value set as application property for Google service account will be used as owner for this folder. If this argument is defined, the folder owner will be this user. |
fileId | file identifier |
key | property identifier |
Google Drive - get folder/file information
Syntax:
Description:
Argument | Description |
userId | optional username; if not specified, the userEmail value set as application property for Google service account will be used as owner for this folder. If this argument is defined, the folder owner will be this user. |
fileId | file identifier |
The method returns a javascript object having the following structure:
Google Drive - set file attributes
Change the default file attributes, like trashed, restricted, viewed, etc.
Syntax:
Description:
Argument | Description |
userId | optional username; if not specified, the userEmail value set as application property for Google service account will be used as owner for this folder. If this argument is defined, the folder owner will be this user. |
fileId | file identifier |
fileAttributes | a javascript object containing the file attributes to set |
The "fileAttributes" javascript object must have the following structure:
Google Drive - get file revisions
It is possible to upload the same file multiple times; each time the new version will replace the previous one. However, the older versions are still available; this method allows to access to the previous versions of the file.
Syntax:
Description:
Argument | Description |
userId | optional username; if not specified, the userEmail value set as application property for Google service account will be used as owner for this folder. If this argument is defined, the folder owner will be this user. |
fileId | file identifier |
The method returns a list of javascript objects, where each object (related to a revision) has the following structure:
Google Drive - get folder content
Retrieve the folder content, in terms of files or subfolders.
Syntax:
Description:
Argument | Description |
userId | optional username; if not specified, the userEmail value set as application property for Google service account will be used as owner for this folder. If this argument is defined, the folder owner will be this user. |
folderId | folder identifier |
query | optional query used to filter the folder content; see https://developers.google.com/drive/web/search-parameters for additional details |
trashed | boolean flag; true to fetch also deleted (trashed) files and folders. |
The method returns a Java List containing Java objects, where each object (related to a file/folder) has the following structure:
Example:
Google Drive - get folder content (ids)
Retrieve the folder content, in terms of files or subfolders, each expressed only through its id.
Syntax:
Description:
Argument | Description |
userId | optional username; if not specified, the userEmail value set as application property for Google service account will be used as owner for this folder. If this argument is defined, the folder owner will be this user. |
folderId | folder identifier |
query | optional query used to filter the folder content; see https://developers.google.com/drive/web/search-parameters for additional details |
trashed | boolean flag; true to fetch also deleted (trashed) files and folders. |
The method returns a list of file/folder ids.
Google Drive - duplicate a file
Starting from an already existing document in Drive, duplicate it with another name in the specified destination folder..
Syntax:
Description:
Argument | Description |
userId | email for the user used to create the file |
sourceFileId | document id related to the already existing file in Drive to duplicate |
destinationFolderId | folder id where copying the file |
newFileName | the new file name to assign to the duplicated document |
copyPermissions | boolean flag used to inherit permissions assigned to the source document |
The method returns a Java object, having the following structure:
Google Drive - get folder content, one page a time
Retrieve the folder content, in terms of files or subfolders, one page a time. It is possible to scroll along the whole content, by working through "maxPageResults" and "pages". This method can be helpful within a javascript business component for list, in case you want to show in a paginated grid the folder content and navigate through it, one page a time.
Syntax:
Description:
Argument | Description |
maxPageResults | max number of files/subfolders to get back, that will fill in the page |
pages | page to read |
nextPageToken | token to pass forward to the next invocation of this method, in order to get the next page of results |
folderId | folder identifier to use when retrieving the content |
query | optional query to use to filter folder content |
trashed | boolean flag; true to fetch also deleted (trashed) files and folders. |
This method returns a javascript object containing the following structure:
Google Drive - move file/folder
Move the specified folder, by specifying new parent folders.
Syntax:
Description:
Argument | Description |
userId | optional username; if not specified, the userEmail value set as application property for Google service account will be used as owner for this folder. If this argument is defined, the folder owner will be this user. |
fileId | folder identifier |
parentsToAdd | a comma separated list of folder ids that will be added as parents of the file/folder. Can be empty |
parentsToRemove | a comma separated list of folder ids that will be removed as parents of the file/folder. Can be empty |
Google Drive - move file
Move the specified folder, by specifying new parent folders.
Syntax:
Description:
Argument | Description |
userId | optional username; if not specified, the userEmail value set as application property for Google service account will be used as owner for this folder. If this argument is defined, the folder owner will be this user. |
fileId | file identifier |
newParents | a comma separated list of folder ids that will be added as parents of the file/folder. Can be empty |
Google Drive - upload a file from the server file system
Upload into Drive the specified file stored in the server file system.
Syntax:
Description:
Argument | Description |
userId | optional username; if not specified, the userEmail value set as application property for Google service account will be used as owner for this folder. If this argument is defined, the folder owner will be this user. |
fsPath | the full path of the file to upload. This path is in the server where 4WS.Platform is installed |
baseFolderId | the id of the Drive folder where the named folder must be created |
folderName | a name of the folder where the file must be uploaded to. This folder must be in the base folder |
createFolderIfNotExists | true or false. Whether or not to create the folderName folder if not exists in the base folder |
fileName | the new name of the uploaded file. If null the original file name is used |
deleteJsFile | true or false. Specifies if the file on file system must be deleted or not after upload to Drive |
Google Drive - replace an already existing Drive file from the server file system
Upload the specified file stored in the server file system.
Syntax:
Description:
Argument | Description |
userId | optional username; if not specified, the userEmail value set as application property for Google service account will be used as owner for this folder. If this argument is defined, the folder owner will be this user. |
fileId | file identifier, related to the already existing file in Drive |
fsPath | the full path of the file to upload. This path is in the server where 4WS.Platform is installed |
deleteFsFile | true or false. Specifies if the file on file system must be deleted or not after upload to Drive |
newRevision | true/false. If true the file will be new version of a possible homonymous file in the destination folder. If false two files with the same name will be present in the destination folder |
Google Drive - download a file from Drive
Download a file from Drive and save it on the server file system.
Syntax:
Description:
Argument | Description |
userId | optional username; if not specified, the userEmail value set as application property for Google service account will be used as owner for this folder. If this argument is defined, the folder owner will be this user. |
fileId | file identifier, related to the already existing file in Drive |
localPath | the full path on the server file syste, where saving the file |
fileName | fileName to use when saving the file on the specified "localPath" |
Google Drive - get an URL to download a file from Drive web page
Get an URL related to the Drive file to download.
Syntax:
Description:
Argument | Description |
fileId | file identifier, related to the already existing file in Drive |
Google Drive - get an URL to open a file from GDrive web page
Returns the URL to open a file from Google Drive. This URL shoud be opened in a browser and must be used for files in Google format (documents, spreadsheets, presentations, forms and so on).
Syntax:
Description:
Argument | Description |
userId | optional username; if not specified, the userEmail value set as application property for Google service account will be used as owner for this folder. If this argument is defined, the folder owner will be this user. |
fileId | file identifier, related to the already existing file in Drive |
Last updated