Fetch full contact details from Starface instead of summary

The contacts list endpoint only returns summaryValues/phoneNumbers.
Now fetch each contact individually via GET /contacts/{id} to get
all fields (blocks/attributes). Also log the detail JSON structure
so we can verify the field mapping is correct.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
duffyduck 2026-04-03 12:50:16 +02:00
parent 3c38a1a6cc
commit 1be0a94b51
1 changed files with 26 additions and 7 deletions

View File

@ -209,15 +209,34 @@ namespace StarfaceOutlookSync.Services
if (array.Count == 0) break; if (array.Count == 0) break;
// Ersten Kontakt als Debug-Info loggen OnDebug?.Invoke($"Seite {page}: {array.Count} Kontakte in Liste");
if (firstPage && array.Count > 0)
{
OnDebug?.Invoke($"Starface API Rohdaten (1. Kontakt):\n{array[0].ToString(Formatting.Indented)}");
firstPage = false;
}
// Die Listen-API gibt nur Summary zurueck.
// Jeden Kontakt einzeln abrufen fuer alle Felder.
foreach (var item in array) foreach (var item in array)
contacts.Add(MapFromStarface(item)); {
var id = item["id"]?.ToString();
if (string.IsNullOrEmpty(id)) continue;
try
{
var detailResp = await _http.GetAsync($"{_baseUrl}/contacts/{id}");
if (detailResp.IsSuccessStatusCode)
{
var detailBody = await detailResp.Content.ReadAsStringAsync();
var detailObj = JObject.Parse(detailBody);
if (firstPage)
{
OnDebug?.Invoke($"Starface Kontakt-Detail (1. Kontakt):\n{detailObj.ToString(Formatting.Indented)}");
firstPage = false;
}
contacts.Add(MapFromStarface(detailObj));
}
}
catch { }
}
if (array.Count < pageSize) break; if (array.Count < pageSize) break;
page++; page++;