Add debug logging and tag to UpdateContactAsync
- Include tags in PUT request (Starface may require it) - Log failed updates with status code and response body - Also committed: SafeGet for Outlook COM property reading Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
7ffaddc77f
commit
6349424007
|
|
@ -304,12 +304,27 @@ namespace StarfaceOutlookSync.Services
|
|||
{
|
||||
var sfContact = MapToStarface(contact);
|
||||
sfContact["id"] = contactId;
|
||||
|
||||
// Tag beibehalten
|
||||
if (!string.IsNullOrEmpty(book.TagId))
|
||||
{
|
||||
sfContact["tags"] = new JArray { new JObject { ["id"] = book.TagId } };
|
||||
}
|
||||
|
||||
var query = "";
|
||||
if (book.Type == "user" && !string.IsNullOrEmpty(book.UserId))
|
||||
query = $"?userId={book.UserId}";
|
||||
|
||||
var content = new StringContent(sfContact.ToString(), Encoding.UTF8, "application/json");
|
||||
var body = sfContact.ToString();
|
||||
var content = new StringContent(body, Encoding.UTF8, "application/json");
|
||||
var resp = await _http.PutAsync($"{_baseUrl}/contacts/{contactId}{query}", content);
|
||||
|
||||
if (!resp.IsSuccessStatusCode)
|
||||
{
|
||||
var respBody = await resp.Content.ReadAsStringAsync();
|
||||
OnDebug?.Invoke($"PUT /contacts/{contactId} fehlgeschlagen: {(int)resp.StatusCode}\n{respBody}");
|
||||
}
|
||||
|
||||
return resp.IsSuccessStatusCode;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue