Compare commits
9 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
b07a3b3a87 | |
|
|
f620e96d23 | |
|
|
e8731a87d4 | |
|
|
53ca4611d1 | |
|
|
df13ddf6b1 | |
|
|
c08a625348 | |
|
|
4484f19d14 | |
|
|
ca17e5d433 | |
|
|
d89e36b962 |
26
README.md
26
README.md
|
|
@ -42,6 +42,32 @@ Windows-Anwendung zur bidirektionalen Synchronisation von Kontakten zwischen Mic
|
||||||
5. Starface-Adressbuch und Outlook-Kontaktordner waehlen
|
5. Starface-Adressbuch und Outlook-Kontaktordner waehlen
|
||||||
6. Speichern und "Jetzt synchronisieren"
|
6. Speichern und "Jetzt synchronisieren"
|
||||||
|
|
||||||
|
### Outlook-Sicherheitsabfrage unterdruecken
|
||||||
|
|
||||||
|
Beim Zugriff auf Outlook-Kontakte zeigt Outlook standardmaessig einen
|
||||||
|
Sicherheitsdialog ("Ein Programm versucht auf Ihre E-Mail-Adressinformationen
|
||||||
|
zuzugreifen"). Dieser kann in den Einstellungen der App deaktiviert werden:
|
||||||
|
|
||||||
|
1. In der App auf "Einstellungen" klicken
|
||||||
|
2. "Outlook-Sicherheitsabfrage automatisch erlauben" aktivieren
|
||||||
|
3. Speichern
|
||||||
|
|
||||||
|
**Auf Domaenen-PCs / Terminal Servern:**
|
||||||
|
|
||||||
|
Die Outlook-Sicherheitseinstellungen werden dort per Gruppenrichtlinie (GPO)
|
||||||
|
gesteuert und sind im Trust Center ausgegraut. In diesem Fall muss die App
|
||||||
|
**einmalig als Administrator** gestartet werden, damit die Registry-Keys
|
||||||
|
unter HKLM geschrieben werden koennen:
|
||||||
|
|
||||||
|
1. Rechtsklick auf die App -> "Als Administrator ausfuehren"
|
||||||
|
2. Einstellungen -> "Outlook-Sicherheitsabfrage automatisch erlauben" aktivieren
|
||||||
|
3. Speichern und App schliessen
|
||||||
|
4. Outlook neu starten
|
||||||
|
5. App kann danach wieder normal (ohne Admin) gestartet werden
|
||||||
|
|
||||||
|
Die Einstellung bleibt dauerhaft bestehen und gilt fuer alle Benutzer
|
||||||
|
auf dem Rechner.
|
||||||
|
|
||||||
### Deinstallation
|
### Deinstallation
|
||||||
|
|
||||||
Ueber Windows Einstellungen -> Apps oder die Systemsteuerung.
|
Ueber Windows Einstellungen -> Apps oder die Systemsteuerung.
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
; Erfordert Inno Setup 6.x (https://jrsoftware.org/isinfo.php)
|
; Erfordert Inno Setup 6.x (https://jrsoftware.org/isinfo.php)
|
||||||
|
|
||||||
#define MyAppName "Starface Outlook Sync"
|
#define MyAppName "Starface Outlook Sync"
|
||||||
#define MyAppVersion "0.0.0.20"
|
#define MyAppVersion "0.0.0.23"
|
||||||
#define MyAppPublisher "HackerSoft - Hacker-Net Telekommunikation"
|
#define MyAppPublisher "HackerSoft - Hacker-Net Telekommunikation"
|
||||||
#define MyAppURL "https://www.hacker-net.de"
|
#define MyAppURL "https://www.hacker-net.de"
|
||||||
#define MyAppExeName "StarfaceOutlookSync.exe"
|
#define MyAppExeName "StarfaceOutlookSync.exe"
|
||||||
|
|
|
||||||
|
|
@ -40,40 +40,81 @@ namespace StarfaceOutlookSync.Models
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ApplyOutlookSecuritySetting()
|
public void ApplyOutlookSecuritySetting()
|
||||||
|
{
|
||||||
|
var versions = new[] { "16.0", "15.0" };
|
||||||
|
|
||||||
|
var securityValues = new (string name, int value)[]
|
||||||
|
{
|
||||||
|
("ObjectModelGuard", 2),
|
||||||
|
("PromptOOMAddressBookAccess", 2),
|
||||||
|
("PromptOOMAddressInformationAccess", 2),
|
||||||
|
("PromptOOMSend", 2),
|
||||||
|
("PromptOOMSaveAs", 2),
|
||||||
|
("PromptOOMFormulaAccess", 2),
|
||||||
|
("PromptOOMCustomAction", 2),
|
||||||
|
("PromptSimpleMAPISend", 2),
|
||||||
|
("PromptSimpleMAPINameResolve", 2),
|
||||||
|
("PromptSimpleMAPIOpenMessage", 2),
|
||||||
|
("AdminSecurityMode", 3),
|
||||||
|
};
|
||||||
|
|
||||||
|
// In alle moeglichen Pfade schreiben (HKCU + HKLM, Policies + direkt)
|
||||||
|
var roots = new[] { Registry.CurrentUser, Registry.LocalMachine };
|
||||||
|
var prefixes = new[]
|
||||||
|
{
|
||||||
|
@"Software\Policies\Microsoft\Office",
|
||||||
|
@"Software\Microsoft\Office"
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (var ver in versions)
|
||||||
|
{
|
||||||
|
foreach (var root in roots)
|
||||||
|
{
|
||||||
|
foreach (var prefix in prefixes)
|
||||||
|
{
|
||||||
|
var regPath = $@"{prefix}\{ver}\Outlook\Security";
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (AutoAcceptOutlookPrompt)
|
||||||
|
{
|
||||||
|
var key = root.CreateSubKey(regPath);
|
||||||
|
if (key != null)
|
||||||
|
{
|
||||||
|
foreach (var (name, value) in securityValues)
|
||||||
|
key.SetValue(name, value, RegistryValueKind.DWord);
|
||||||
|
key.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
try { root.DeleteSubKey(regPath, false); } catch { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { } // Kein Fehler wenn Rechte fehlen - naechsten Pfad versuchen
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prueft ob die Outlook-Sicherheitseinstellung per GPO blockiert wird.
|
||||||
|
/// </summary>
|
||||||
|
public static bool IsOutlookSecurityLockedByPolicy()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var regPath = @"Software\Policies\Microsoft\Office\16.0\Outlook\Security";
|
// Wenn HKLM Policies gesetzt sind und wir dort nicht schreiben koennen
|
||||||
|
var key = Registry.LocalMachine.OpenSubKey(
|
||||||
if (AutoAcceptOutlookPrompt)
|
@"Software\Policies\Microsoft\Office\16.0\Outlook\Security", false);
|
||||||
|
if (key != null)
|
||||||
{
|
{
|
||||||
// Alle Outlook Object Model Guard Prompts unterdruecken
|
var val = key.GetValue("AdminSecurityMode");
|
||||||
var key = Registry.CurrentUser.CreateSubKey(regPath);
|
|
||||||
key.SetValue("ObjectModelGuard", 2, RegistryValueKind.DWord);
|
|
||||||
key.SetValue("PromptOOMAddressBookAccess", 2, RegistryValueKind.DWord);
|
|
||||||
key.SetValue("PromptOOMAddressInformationAccess", 2, RegistryValueKind.DWord);
|
|
||||||
key.SetValue("AdminSecurityMode", 3, RegistryValueKind.DWord);
|
|
||||||
key.Close();
|
key.Close();
|
||||||
}
|
if (val != null) return true;
|
||||||
else
|
|
||||||
{
|
|
||||||
// Zurueck auf Standard (Werte loeschen)
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var key = Registry.CurrentUser.OpenSubKey(regPath, true);
|
|
||||||
if (key != null)
|
|
||||||
{
|
|
||||||
try { key.DeleteValue("ObjectModelGuard"); } catch { }
|
|
||||||
try { key.DeleteValue("PromptOOMAddressBookAccess"); } catch { }
|
|
||||||
try { key.DeleteValue("PromptOOMAddressInformationAccess"); } catch { }
|
|
||||||
try { key.DeleteValue("AdminSecurityMode"); } catch { }
|
|
||||||
key.Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch { }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -183,7 +183,21 @@ namespace StarfaceOutlookSync.Services
|
||||||
|
|
||||||
if (oc == null && sc != null)
|
if (oc == null && sc != null)
|
||||||
{
|
{
|
||||||
// In Outlook geloescht -> in Starface auch loeschen
|
// Outlook-Kontakt nicht gefunden.
|
||||||
|
// Erst pruefen ob er vielleicht nur eine neue EntryID hat
|
||||||
|
var reMatch = FindMatch(sc, outlookContacts.Where(c =>
|
||||||
|
!processedOutlookIds.Contains(c.OutlookEntryId)).ToList());
|
||||||
|
if (reMatch != null)
|
||||||
|
{
|
||||||
|
// Kontakt existiert noch in Outlook, nur EntryID geaendert
|
||||||
|
Log($" EntryID geaendert, verknuepfe neu: {sc.DisplayName}");
|
||||||
|
mapping.OutlookEntryId = reMatch.OutlookEntryId;
|
||||||
|
processedOutlookIds.Add(reMatch.OutlookEntryId);
|
||||||
|
newMappings.Add(mapping);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wirklich geloescht -> in Starface auch loeschen
|
||||||
if (profile.SyncDirection == SyncDirection.Both || profile.SyncDirection == SyncDirection.OutlookToStarface)
|
if (profile.SyncDirection == SyncDirection.Both || profile.SyncDirection == SyncDirection.OutlookToStarface)
|
||||||
{
|
{
|
||||||
if (await starface.DeleteContactAsync(mapping.StarfaceId))
|
if (await starface.DeleteContactAsync(mapping.StarfaceId))
|
||||||
|
|
@ -194,7 +208,6 @@ namespace StarfaceOutlookSync.Services
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Richtung erlaubt kein Loeschen -> Mapping behalten
|
|
||||||
newMappings.Add(mapping);
|
newMappings.Add(mapping);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -202,20 +215,12 @@ namespace StarfaceOutlookSync.Services
|
||||||
|
|
||||||
if (oc != null && sc == null)
|
if (oc != null && sc == null)
|
||||||
{
|
{
|
||||||
// In Starface geloescht -> in Outlook auch loeschen
|
// Starface-Kontakt nicht gefunden.
|
||||||
if (profile.SyncDirection == SyncDirection.Both || profile.SyncDirection == SyncDirection.StarfaceToOutlook)
|
// Kann passieren wenn der Kontakt einem anderen Adressbuch gehoert.
|
||||||
{
|
// NICHT loeschen, nur Mapping entfernen - wird in Phase 2/3 neu verknuepft
|
||||||
if (_outlookService.DeleteContact(mapping.OutlookEntryId))
|
Log($" Starface-Kontakt nicht in Liste (anderes Adressbuch?): {oc.DisplayName}");
|
||||||
{
|
// Mapping verwerfen, Outlook-Kontakt als unverarbeitet belassen
|
||||||
result.Updated++;
|
// damit er in Phase 2 neu zugeordnet oder erstellt werden kann
|
||||||
Log($" Geloescht (SF->OL): {oc.DisplayName}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Richtung erlaubt kein Loeschen -> Mapping behalten
|
|
||||||
newMappings.Add(mapping);
|
|
||||||
}
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,9 @@
|
||||||
<AssemblyTitle>Starface Outlook Sync</AssemblyTitle>
|
<AssemblyTitle>Starface Outlook Sync</AssemblyTitle>
|
||||||
<Company>HackerSoft - Hacker-Net Telekommunikation</Company>
|
<Company>HackerSoft - Hacker-Net Telekommunikation</Company>
|
||||||
<Product>Starface Outlook Sync</Product>
|
<Product>Starface Outlook Sync</Product>
|
||||||
<Version>0.0.0.20</Version>
|
<Version>0.0.0.23</Version>
|
||||||
<AssemblyVersion>0.0.0.20</AssemblyVersion>
|
<AssemblyVersion>0.0.0.23</AssemblyVersion>
|
||||||
<FileVersion>0.0.0.20</FileVersion>
|
<FileVersion>0.0.0.23</FileVersion>
|
||||||
<Description>Synchronisiert Outlook-Kontakte mit Starface Telefonanlage</Description>
|
<Description>Synchronisiert Outlook-Kontakte mit Starface Telefonanlage</Description>
|
||||||
<Copyright>Stefan Hacker - HackerSoft</Copyright>
|
<Copyright>Stefan Hacker - HackerSoft</Copyright>
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ namespace StarfaceOutlookSync.UI
|
||||||
|
|
||||||
var lblVersion = new Label
|
var lblVersion = new Label
|
||||||
{
|
{
|
||||||
Text = "Version 0.0.0.20",
|
Text = "Version 0.0.0.23",
|
||||||
Left = 0, Top = 56, Width = 340, Height = 20,
|
Left = 0, Top = 56, Width = 340, Height = 20,
|
||||||
TextAlign = ContentAlignment.MiddleCenter,
|
TextAlign = ContentAlignment.MiddleCenter,
|
||||||
ForeColor = Color.Gray
|
ForeColor = Color.Gray
|
||||||
|
|
|
||||||
|
|
@ -76,8 +76,8 @@ namespace StarfaceOutlookSync.UI
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
Text = "Starface Kontakt-Sync";
|
Text = "Starface Kontakt-Sync";
|
||||||
Size = new Size(620, 450);
|
Size = new Size(830, 450);
|
||||||
MinimumSize = new Size(500, 350);
|
MinimumSize = new Size(830, 350);
|
||||||
StartPosition = FormStartPosition.CenterScreen;
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
Font = new Font("Segoe UI", 9);
|
Font = new Font("Segoe UI", 9);
|
||||||
Icon = AppIcon.GetIcon();
|
Icon = AppIcon.GetIcon();
|
||||||
|
|
|
||||||
|
|
@ -47,20 +47,33 @@ namespace StarfaceOutlookSync.UI
|
||||||
Checked = _settings.AutoAcceptOutlookPrompt
|
Checked = _settings.AutoAcceptOutlookPrompt
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var hintText = "Hinweis: Outlook muss nach Aenderung neu gestartet werden.";
|
||||||
|
if (UserSettings.IsOutlookSecurityLockedByPolicy())
|
||||||
|
hintText += "\nAuf Domaenen-PCs: App einmalig als Admin starten!";
|
||||||
|
|
||||||
|
var lblHint = new Label
|
||||||
|
{
|
||||||
|
Text = hintText,
|
||||||
|
Left = 38, Top = 102, Width = 310, Height = 36,
|
||||||
|
ForeColor = UserSettings.IsOutlookSecurityLockedByPolicy() ? Color.OrangeRed : Color.Gray,
|
||||||
|
Font = new Font("Segoe UI", 8)
|
||||||
|
};
|
||||||
|
|
||||||
_btnSave = new Button
|
_btnSave = new Button
|
||||||
{
|
{
|
||||||
Text = "Speichern", Left = 95, Top = 160, Width = 85, Height = 28,
|
Text = "Speichern", Left = 95, Top = 170, Width = 85, Height = 28,
|
||||||
DialogResult = DialogResult.None
|
DialogResult = DialogResult.None
|
||||||
};
|
};
|
||||||
_btnSave.Click += (s, e) => Save();
|
_btnSave.Click += (s, e) => Save();
|
||||||
|
|
||||||
_btnCancel = new Button
|
_btnCancel = new Button
|
||||||
{
|
{
|
||||||
Text = "Abbrechen", Left = 189, Top = 160, Width = 85, Height = 28,
|
Text = "Abbrechen", Left = 189, Top = 170, Width = 85, Height = 28,
|
||||||
DialogResult = DialogResult.Cancel
|
DialogResult = DialogResult.Cancel
|
||||||
};
|
};
|
||||||
|
|
||||||
Controls.AddRange(new Control[] { _chkStartMinimized, _chkSyncOnStart, _chkAutoAcceptOutlook, _btnSave, _btnCancel });
|
Size = new Size(380, 260);
|
||||||
|
Controls.AddRange(new Control[] { _chkStartMinimized, _chkSyncOnStart, _chkAutoAcceptOutlook, lblHint, _btnSave, _btnCancel });
|
||||||
AcceptButton = _btnSave;
|
AcceptButton = _btnSave;
|
||||||
CancelButton = _btnCancel;
|
CancelButton = _btnCancel;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue