Describe the feature you'd like to request
When importing contacts from Google using the Google Integration app (integration_google), Nextcloud fetches contact details via the Google People API. Currently, the sync process extracts structured name components (names) but completely ignores the fileAs field (documented in Google People API Reference).
My Use Case
I have a large number of contacts sharing identical first and last names. To distinguish between them, I utilize Google's fileAs field to add crucial context or custom nicknames without cluttering the structural First/Last name fields.
For example, I have multiple entries for "Alex Schmidt":
| First Name |
Last Name |
Google fileAs / Intended UI Display Name |
| Alex |
Schmidt |
Alex Schmidt (climbing) |
| Alex |
Schmidt |
Alex Schmidt (surfing) |
When syncing via the integration app, the unique fileAs value is dropped. As a result, they all show up identically as "Alex Schmidt" in Nextcloud Contacts, creating massive ambiguity in the address book.
Describe the solution you'd like
I would like GoogleContactsAPIService.php to check for the presence of the fileAs field in the Google API payload. If fileAs is set and not empty, it should be used to overwrite or fill the $displayName / vCard FN (Formatted Name) property, while leaving the structured N property intact.
Proposed Code Solution
In lib/Service/GoogleContactsAPIService.php, the current code blocks populate $displayName solely from $n['displayName']:
\$displayName = '';
// we just take first name
if (isset(\$c['names']) && is_array(\$c['names'])) {
/** @var array{displayName?: string, familyName?: string, givenName?: string, middleName?: string, honorificPrefix?: string, honorificSuffix?: string } \$n */
foreach (\$c['names'] as \$n) {
\$displayName = \$n['displayName'] ?? '';
\$familyName = \$n['familyName'] ?? '';
\$firstName = \$n['givenName'] ?? '';
\$additionalName = \$n['middleName'] ?? '';
\$prefix = \$n['honorificPrefix'] ?? '';
\$suffix = \$n['honorificSuffix'] ?? '';
if (\$familyName || \$firstName || \$additionalName || \$prefix || \$suffix) {
\$prop = \$vCard->createProperty('N', [0 => \$familyName, 1 => \$firstName, 2 => \$additionalName, 3 => \$prefix, 4 => \$suffix]);
\$vCard->add(\$prop);
}
break;
}
}
// PROPOSED ADDITION:
// Check for the Google People API 'fileAs' field to preserve custom display contexts
if (isset(\$c['fileAs']) && is_array(\$c['fileAs'])) {
foreach (\$c['fileAs'] as \$f) {
if (!empty(\$f['value'])) {
\$displayName = \$f['value'];
break;
}
}
}
This logic ensures that if a user has explicitly defined a "File As" format in Google, Nextcloud respects this as the primary display string (FN property) in the address book, avoiding duplicated visual names.
Describe alternatives you've considered
- Manual Editing: Manually editing hundreds of contacts inside Nextcloud after the initial sync to append the bracketed context to the display names. This is extremely time-consuming and inefficient.
- Polluting Structural Fields: Appending the context (e.g.,
(climbing)) directly into the "First Name" or "Last Name" fields inside Google Contacts before importing. However, this breaks standard name structures, messes up formal alphabetical sorting, and pollutes the clean name data.
- Custom Scripting: Writing a standalone python/php script to intercept Google VCF exports and batch-rename properties via regex before importing them to Nextcloud. While functional for a one-time migration, this does not help users who rely on the automated
integration_google application for continuous syncing.
Describe the feature you'd like to request
When importing contacts from Google using the Google Integration app (
integration_google), Nextcloud fetches contact details via the Google People API. Currently, the sync process extracts structured name components (names) but completely ignores thefileAsfield (documented in Google People API Reference).My Use Case
I have a large number of contacts sharing identical first and last names. To distinguish between them, I utilize Google's
fileAsfield to add crucial context or custom nicknames without cluttering the structural First/Last name fields.For example, I have multiple entries for "Alex Schmidt":
fileAs/ Intended UI Display NameWhen syncing via the integration app, the unique
fileAsvalue is dropped. As a result, they all show up identically as "Alex Schmidt" in Nextcloud Contacts, creating massive ambiguity in the address book.Describe the solution you'd like
I would like
GoogleContactsAPIService.phpto check for the presence of thefileAsfield in the Google API payload. IffileAsis set and not empty, it should be used to overwrite or fill the$displayName/ vCardFN(Formatted Name) property, while leaving the structuredNproperty intact.Proposed Code Solution
In
lib/Service/GoogleContactsAPIService.php, the current code blocks populate$displayNamesolely from$n['displayName']:This logic ensures that if a user has explicitly defined a "File As" format in Google, Nextcloud respects this as the primary display string (
FNproperty) in the address book, avoiding duplicated visual names.Describe alternatives you've considered
(climbing)) directly into the "First Name" or "Last Name" fields inside Google Contacts before importing. However, this breaks standard name structures, messes up formal alphabetical sorting, and pollutes the clean name data.integration_googleapplication for continuous syncing.