public static void RemoveUnwantedShortcuts(_OutlookBarShortcuts outlookBarShortcuts) { RemoveShortcut("Deltaview", outlookBarShortcuts); RemoveShortcut("Workshare Deltaview", outlookBarShortcuts); }
public static void RemoveShortcut(string name, _OutlookBarShortcuts outlookBarShortcuts) { long index = GetShortcutIndex(name, outlookBarShortcuts); if (index == -1) { return; } outlookBarShortcuts.Remove(index); }
public static long GetShortcutIndex(string name, _OutlookBarShortcuts outlookBarShortcuts) { if (outlookBarShortcuts == null) { return -1; } long count = outlookBarShortcuts.Count; try { for (long position = 1; position <= count; position++) { OutlookBarShortcut shortcut = outlookBarShortcuts[position]; using (new ComRelease(shortcut)) { if (shortcut != null) { if (string.Compare(name, shortcut.Name, true) == 0) { return position; } } } } } catch { // Winqual errors indicate that in some circumstances either accessing pSC->Name or // converting it to a PCMYSTR throws. If that does occur we don't want to crash Outlook } return -1; }