Set Outlook security registry keys for all Office versions

Apply to both 16.0 (2016-2024/365) and 15.0 (2013) registry
paths. Costs nothing and ensures it works regardless of which
Office version is installed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
duffyduck 2026-04-03 19:31:08 +02:00
parent d89e36b962
commit ca17e5d433
1 changed files with 30 additions and 27 deletions

View File

@ -40,14 +40,18 @@ namespace StarfaceOutlookSync.Models
} }
public void ApplyOutlookSecuritySetting() public void ApplyOutlookSecuritySetting()
{
// Alle Office-Versionen abdecken (16.0 = 2016/2019/2021/2024/365, 15.0 = 2013)
var versions = new[] { "16.0", "15.0" };
foreach (var ver in versions)
{ {
try try
{ {
var regPath = @"Software\Policies\Microsoft\Office\16.0\Outlook\Security"; var regPath = $@"Software\Policies\Microsoft\Office\{ver}\Outlook\Security";
if (AutoAcceptOutlookPrompt) if (AutoAcceptOutlookPrompt)
{ {
// Alle Outlook Object Model Guard Prompts unterdruecken
var key = Registry.CurrentUser.CreateSubKey(regPath); var key = Registry.CurrentUser.CreateSubKey(regPath);
key.SetValue("ObjectModelGuard", 2, RegistryValueKind.DWord); key.SetValue("ObjectModelGuard", 2, RegistryValueKind.DWord);
key.SetValue("PromptOOMAddressBookAccess", 2, RegistryValueKind.DWord); key.SetValue("PromptOOMAddressBookAccess", 2, RegistryValueKind.DWord);
@ -64,10 +68,8 @@ namespace StarfaceOutlookSync.Models
} }
else else
{ {
// Zurueck auf Standard (Werte loeschen)
try try
{ {
// Kompletten Security-Schluessel entfernen
Registry.CurrentUser.DeleteSubKey(regPath, false); Registry.CurrentUser.DeleteSubKey(regPath, false);
} }
catch { } catch { }
@ -77,3 +79,4 @@ namespace StarfaceOutlookSync.Models
} }
} }
} }
}