From 484e90802668a4440e435e814e237def64a089bc Mon Sep 17 00:00:00 2001 From: PointStar Date: Mon, 11 May 2026 16:31:47 +0300 Subject: [PATCH] fix(addin-host): treat API key alone as configured (don't require username) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After the previous fix made Username optional in the Settings dialog and the credential store, TryInitializeCrm still bailed out when Username was blank — leaving the add-in in "not configured" state even though the user had saved a valid API key. Only ApiKey is required now. The check matches the new contract used by EspoCrmClient (X-Api-Key alone is sufficient for API-User credentials). Co-Authored-By: Claude Opus 4.7 (1M context) --- src/OutlookAddin/Services/AddInHost.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OutlookAddin/Services/AddInHost.cs b/src/OutlookAddin/Services/AddInHost.cs index 665a8c6..4552280 100644 --- a/src/OutlookAddin/Services/AddInHost.cs +++ b/src/OutlookAddin/Services/AddInHost.cs @@ -284,9 +284,9 @@ namespace OutlookAddin.Services DisposeCrmStack(); var creds = CredentialStore.Load(); - if (creds == null || string.IsNullOrWhiteSpace(creds.Username) || string.IsNullOrWhiteSpace(creds.ApiKey)) + if (creds == null || string.IsNullOrWhiteSpace(creds.ApiKey)) { - Logger.Information("AddInHost: no stored credentials — CRM features disabled until first-run setup"); + Logger.Information("AddInHost: no stored API key — CRM features disabled until first-run setup"); CrmClientChanged?.Invoke(this, EventArgs.Empty); return; }