'Moving from other contacts group in google contacts using google app scripts

I cant move my other contacts to my system group contacts via GAS

  var activeSheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();

  var group  = ContactsApp.getContactGroup('Other Contacts');
  var contacts = ContactsApp.getContactsByGroup(group);
  var mainGroup = ContactsApp.getContactGroup("System Group: My Contacts");

  for (var i in contacts) {
    mainGroup.addContact(contacts[i]);
  }

I think issue in "other contact" system group name, but I can't find any information about names.



Solution 1:[1]

Unfortunately, 'Other Contacts' cannot be retrieved using ContactsApp.getContactGroup. They live their own life. To get those you need to use People.OtherContacts.list method.

var people = People.OtherContacts.list({readMask:'emailAddresses'});
for(var i=0; i<=people.otherContacts.length; i++){
    var response = People.OtherContacts.copyOtherContactToMyContactsGroup({
        "copyMask": "names,emailAddresses"
    },people.otherContacts[i].resourceName);
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Skoua