How I can connect and sync with Google Contacts? How do I use google calendar?
Asked
Active
Viewed 771 times
2 Answers
2
You can try this simple example that shows how to add a Contact to your Google Account using App Maker. For this, I am using the “addToGroup(group)” method as explained here https://developers.google.com/apps-script/reference/contacts/contact#addtogroupgroup
- Create a new App Maker application.
- Add a new Server Script to your App Maker app and add the following code:
function addContact() { // The code below creates a new contact and then adds it to the contact group named // "My Contacts" var contact = ContactsApp.createContact('John', 'Doe', 'john.doe@example.com'); var group = ContactsApp.getContactGroup('System Group: My Contacts'); contact = contact.addToGroup(group); }
- Create a new "Page" in App Maker and add a Button widget
- Select the Button widget and using the Property editor, choose "onClick" > Custom Action
- Add the following code to the onClick custom action:
function onSuccess() { console.log("New Contact added succesfully"); } google.script.run.withSuccessHandler(onSuccess).addContact();
Note that in order to call a server script, you will need to use google.script.run as explained here https://developers.google.com/appmaker/scripting/client#call_a_server_script
- Preview you App Maker application
- Click the Button widget and the new contact will be added under "My Contacts" here https://contacts.google.com/
Hope this helps!

Wilmar
- 273
- 2
- 8
-
thank you you have been very kind I will try to start from Your have a full integration of google contacts Thanks again – Marco De Nuzzo Feb 04 '17 at 14:54
-
a great help but if I wanted to have all my contacts in the app maker and you can edit them? – Marco De Nuzzo Feb 04 '17 at 15:57
0
App Maker runs on Apps Script. So you can write a server-side script using the normal Apps Script APIs to accomplish this. See https://developers.google.com/apps-script/reference/.

Devin Taylor
- 825
- 5
- 11
-
unfortunately I'm not good with scripts you create me a small example to integrate calendar and contacts thanks anyway – Marco De Nuzzo Feb 03 '17 at 09:08