Google Email Labels Fix
This is a fix for Google Contacts where contacts has been created with a custom email label.
Email with custom email labels will not sync to Windows Phone 8.1.
This happens in particular when using GO Contact Sync Mod with Microsoft Outlook.
So when the new contact is created it looks like this:
![image.png](file-guid:064cec9d-ddf6-4327-817d-b9d3455dc969 "image.png")
What we need is a label like “Work” or “Home”:
![image.png](file-guid:0324dffd-bc1e-4a9a-b4e2-e5f5d92bcf5b "image.png")
I have made a little Goggle apps script to fix this:
> _function fixcontacts() {\
> // var contacts = ContactsApp.getContactGroup(‘My Contacts’).getContacts(); \
> var contacts = ContactsApp.getContacts(); \
> Logger.log(‘Start…’)\
> for (var i in contacts) {\
> var addressFields = contacts\[i\].getAddresses();\
> // Logger.log(contacts\[i\].getFullName());\
> var emails = contacts\[i\].getEmails();\
> for (var j in emails) {\
> var label=emails\[j\].getLabel()\
> // Logger.log(label);\
> switch (label) {\
> case ContactsApp.Field.WORK_EMAIL:\
> // Logger.log(‘OK’);\
> break;\
> case ContactsApp.Field.HOME_EMAIL:\
> // Logger.log(‘OK’);\
> break;\
> default:\
> // Logger.log(‘FIX’);\
> Logger.log(‘Fixing ‘ + contacts\[i\].getFullName());\
> switch (j){\
> case ‘0’:\
> emails\[j\].setLabel(ContactsApp.Field.WORK_EMAIL);\
> break;\
> case ‘1’:\
> emails\[j\].setLabel(ContactsApp.Field.HOME_EMAIL);\
> break;\
> default:\
> emails\[j\].setLabel(‘Custom’);\
> break;\
> }\
> break;\
> }\
> }\
> }\
> }_
The script will ignore contacts already having the standard labels “Work” and”Home”.
Anything else with get replace with first “Work” and then “Home” for the second label.
Any subsequent labels will not be changed.
If you are not sure how to create and run scripts then read [this Google page](http://www.google.com/script/start/).
Oh by the way – using this script is on your own responsibility and there is NO support!