WD Accessing the Google contacts - Acessando os Contatos do Google
// The errors are automatically managed:
// If an error occurs, a message is displayed, then resume the input in the window
AContact is a gglContact
sName is string
sEmail is string
sMessaging is string
sPhone is string
// Displays an hourglass to the user
HourGlass(True)
// specify the information
gMyConnection..ClientID = EDT_ID
gMyConnection..ClientSecret = EDT_Key
// Establishes the connection
GglConnect(gMyConnection)
GR_CONNECTION..State = Grayed
GR_CONTACTS..State = DisplayOnly
// Lists the contacts
garrContacts = GglListContact(gMyConnection)
// Browse each contact
FOR ALL ELEMENT AContact OF garrContacts
// Retrieves information about the contact
// Name of contact
sName = AContact..Name
// It at least one email address is specified
IF AContact.Email..Occurrence> 0 THEN
// Retrieves the first email address
sEmail = AContact.Email[1]..Address
ELSE
sEmail = "<no email address>"
END
// It at least one messaging address is specified
IF AContact.InstantMessaging..Occurrence> 0 THEN
// Retrieves the first messaging address
sMessaging = AContact.InstantMessaging[1]..Address
ELSE
sMessaging = "<no messaging address>"
END
// It at least one phone number is specified
IF AContact.PhoneNumber..Occurrence> 0 THEN
// Retrieves the first phone number
sPhone = AContact.PhoneNumber[1]..Number
ELSE
sPhone = "<no phone number>"
END
// Adds the contact into the table
TableAddLine(TABLE_CONTACTS, sName, sEmail+[CR]+sMessaging, sPhone)
END
TableSort(TABLE_CONTACTS,"col_name")
// Disable the hourglass
HourGlass(False)