From 63cfb8b3ee14159d1445759a7221b5a6b3546148 Mon Sep 17 00:00:00 2001 From: RKrom Date: Wed, 18 Apr 2012 10:11:46 +0000 Subject: [PATCH] Fixed Outlook "program access pop-up" for Outlook 2003 git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1793 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4 --- .../OfficeExport/OutlookEmailExporter.cs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/GreenshotInterop/OfficeExport/OutlookEmailExporter.cs b/GreenshotInterop/OfficeExport/OutlookEmailExporter.cs index 0741c7b9a..e3c82b1d1 100644 --- a/GreenshotInterop/OfficeExport/OutlookEmailExporter.cs +++ b/GreenshotInterop/OfficeExport/OutlookEmailExporter.cs @@ -441,7 +441,7 @@ namespace Greenshot.Interop.Office { /// /// private static void InitializeVariables(IOutlookApplication outlookApplication) { - if (outlookApplication == null) { + if (outlookApplication == null || outlookVersion != null) { return; } try { @@ -450,12 +450,15 @@ namespace Greenshot.Interop.Office { } catch (Exception exVersion) { LOG.Error(exVersion); } - try { - INameSpace mapiNamespace = outlookApplication.GetNameSpace("MAPI"); - currentUser = mapiNamespace.CurrentUser.Name; - LOG.InfoFormat("Current user: {0}", currentUser); - } catch (Exception exNS) { - LOG.Error(exNS); + // Preventing retrieval of currentUser if Outlook is older than 2007 + if (outlookVersion.Major >= 12) { + try { + INameSpace mapiNamespace = outlookApplication.GetNameSpace("MAPI"); + currentUser = mapiNamespace.CurrentUser.Name; + LOG.InfoFormat("Current user: {0}", currentUser); + } catch (Exception exNS) { + LOG.Error(exNS); + } } }