// The code below retrieves a contact with the email address "john...@example.com"
// and then deletes that contact.
var contact = ContactsApp.getContact('john...@example.com');
ContactsApp.deleteContact(contact);
IMPORTANT:
This is a business and not a personal e-mail, this message and its attachments are confidential and may also be legally privileged.
If you are not the intended recipient, or have received this e-mail in error, please notify immediately the sender and delete this message and all its attachments.
Any unauthorized review, copying, disclosure, dissemination, or distribution of this message and/or its attachments is strictly forbidden.--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-script-community.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/4462fadc-1e7b-46b7-a48e-1f2df51a48fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
The difference between getContact and getContactsByEmailAddress is that the first one return Contact, but the second return Array of contacts.function delcon() {var emailToDelete = 'te...@domain.com';var results = ContactsApp.getContactsByEmailAddress(emailToDelete);ContactsApp.deleteContact(results[0]);}ABDELLAH NAJIM
Le jeu. 2 mai 2019 à 15:34, Andrea <andrea....@consultant.solgroup.com> a écrit :
Dear,I'm not able to delete a contact.I can't understand what I'm wrongI'm going crazy!This is the Google example ( https://developers.google.com/apps-script/reference/contacts/contacts-app#deletecontactcontact):
// The code below retrieves a contact with the email address "joh...@example.com"
// and then deletes that contact.
var contact = ContactsApp.getContact('john.d...@example.com');
ContactsApp.deleteContact(contact);
This is my function.function delcon() {var emailToDelete = 'te...@domain.com';var results = ContactsApp.getContactsByEmailAddress(emailToDelete);// even with this line the code does not work//var results= ContactsApp.getContact(emailToDelete);ContactsApp.deleteContact(results);};Thank you for your precious helpAndrea
IMPORTANT:
This is a business and not a personal e-mail, this message and its attachments are confidential and may also be legally privileged.
If you are not the intended recipient, or have received this e-mail in error, please notify immediately the sender and delete this message and all its attachments.
Any unauthorized review, copying, disclosure, dissemination, or distribution of this message and/or its attachments is strictly forbidden.--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-community+unsub...@googlegroups.com.
The difference between getContact and getContactsByEmailAddress is that the first one return Contact, but the second return Array of contacts.function delcon() {var emailToDelete = 'te...@domain.com';var results = ContactsApp.getContactsByEmailAddress(emailToDelete);ContactsApp.deleteContact(results[0]);}ABDELLAH NAJIM
Le jeu. 2 mai 2019 à 15:34, Andrea <andrea....@consultant.solgroup.com> a écrit :
Dear,I'm not able to delete a contact.I can't understand what I'm wrongI'm going crazy!This is the Google example ( https://developers.google.com/apps-script/reference/contacts/contacts-app#deletecontactcontact):
// The code below retrieves a contact with the email address "joh...@example.com"
// and then deletes that contact.
var contact = ContactsApp.getContact('john.d...@example.com');
ContactsApp.deleteContact(contact);
This is my function.function delcon() {var emailToDelete = 'te...@domain.com';var results = ContactsApp.getContactsByEmailAddress(emailToDelete);// even with this line the code does not work//var results= ContactsApp.getContact(emailToDelete);ContactsApp.deleteContact(results);};Thank you for your precious helpAndrea
IMPORTANT:
This is a business and not a personal e-mail, this message and its attachments are confidential and may also be legally privileged.
If you are not the intended recipient, or have received this e-mail in error, please notify immediately the sender and delete this message and all its attachments.
Any unauthorized review, copying, disclosure, dissemination, or distribution of this message and/or its attachments is strictly forbidden.--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-community+unsub...@googlegroups.com.
var contact = ContactsApp.getContact('john...@example.com');
ContactsApp.deleteContact(contact);
This is my function.function delcon() {var emailToDelete = 'te...@domain.com';var results = ContactsApp.getContactsByEmailAddress(emailToDelete);// even with this line the code does not work//var results= ContactsApp.getContact(emailToDelete);ContactsApp.deleteContact(results);};Thank you for your precious helpAndrea
IMPORTANT:
This is a business and not a personal e-mail, this message and its attachments are confidential and may also be legally privileged.
If you are not the intended recipient, or have received this e-mail in error, please notify immediately the sender and delete this message and all its attachments.
Any unauthorized review, copying, disclosure, dissemination, or distribution of this message and/or its attachments is strictly forbidden.--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-script-community.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/4462fadc-1e7b-46b7-a48e-1f2df51a48fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
IMPORTANT:
This is a business and not a personal e-mail, this message and its attachments are confidential and may also be legally privileged.
If you are not the intended recipient, or have received this e-mail in error, please notify immediately the sender and delete this message and all its attachments.
Any unauthorized review, copying, disclosure, dissemination, or distribution of this message and/or its attachments is strictly forbidden.--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-script-community.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/ab9252bb-0312-427e-bcb6-1c904f742886%40googlegroups.com.
As you can see from your log what takes 427 seconds is not the deletion process but the getContactsByEmailAddress method.To me it looks like a glitch ... have you tried to run it multiple time with different bogus contacts ?You get the same results or it's usually faster?___Federico Granata
Il giorno gio 2 mag 2019 alle ore 16:58 Andrea <andrea....@consultant.solgroup.com> ha scritto:
Najim, sorry.... some minutes ago i wrote that the code is not working ....the code work and the contact is deleted.but..... is it normal that the deletion of a single contact (my address book is empty!) takes so much time (427 sec.)?
[19-05-02 07:37:06:492 PDT] Starting execution
[19-05-02 07:44:14:093 PDT] ContactsApp.getContactsByEmailAddress([pipp...@pippo.com]) [427.586 seconds]
[19-05-02 07:44:14:272 PDT] Contact.deleteContact() [0.178 seconds][19-05-02 07:44:14:272 PDT] ContactsApp.deleteContact([Contact]) [0.178 seconds][19-05-02 07:44:14:275 PDT] Execution succeeded [427.767 seconds total runtime]Thanks you very much.Andrea
On Thursday, 2 May 2019 16:34:30 UTC+2, Abdellah NAJIM wrote:
The difference between getContact and getContactsByEmailAddress is that the first one return Contact, but the second return Array of contacts.function delcon() {var emailToDelete = 'te...@domain.com';var results = ContactsApp.getContactsByEmailAddress(emailToDelete);ContactsApp.deleteContact(results[0]);}ABDELLAH NAJIM
Le jeu. 2 mai 2019 à 15:34, Andrea <andrea....@consultant.solgroup.com> a écrit :
Dear,I'm not able to delete a contact.I can't understand what I'm wrongI'm going crazy!This is the Google example ( https://developers.google.com/apps-script/reference/contacts/contacts-app#deletecontactcontact):
// The code below retrieves a contact with the email address "joh...@example.com"
// and then deletes that contact.
var contact = ContactsApp.getContact('john.d...@example.com');
ContactsApp.deleteContact(contact);
This is my function.function delcon() {var emailToDelete = 'te...@domain.com';var results = ContactsApp.getContactsByEmailAddress(emailToDelete);// even with this line the code does not work//var results= ContactsApp.getContact(emailToDelete);ContactsApp.deleteContact(results);};Thank you for your precious helpAndrea
IMPORTANT:
This is a business and not a personal e-mail, this message and its attachments are confidential and may also be legally privileged.
If you are not the intended recipient, or have received this e-mail in error, please notify immediately the sender and delete this message and all its attachments.
Any unauthorized review, copying, disclosure, dissemination, or distribution of this message and/or its attachments is strictly forbidden.--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-community+unsub...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-script-community.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/4462fadc-1e7b-46b7-a48e-1f2df51a48fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
IMPORTANT:
This is a business and not a personal e-mail, this message and its attachments are confidential and may also be legally privileged.
If you are not the intended recipient, or have received this e-mail in error, please notify immediately the sender and delete this message and all its attachments.
Any unauthorized review, copying, disclosure, dissemination, or distribution of this message and/or its attachments is strictly forbidden.--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-community+unsub...@googlegroups.com.