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
This commit is contained in:
RKrom 2012-04-18 10:11:46 +00:00
commit 63cfb8b3ee

View file

@ -441,7 +441,7 @@ namespace Greenshot.Interop.Office {
/// </summary> /// </summary>
/// <param name="outlookApplication"></param> /// <param name="outlookApplication"></param>
private static void InitializeVariables(IOutlookApplication outlookApplication) { private static void InitializeVariables(IOutlookApplication outlookApplication) {
if (outlookApplication == null) { if (outlookApplication == null || outlookVersion != null) {
return; return;
} }
try { try {
@ -450,12 +450,15 @@ namespace Greenshot.Interop.Office {
} catch (Exception exVersion) { } catch (Exception exVersion) {
LOG.Error(exVersion); LOG.Error(exVersion);
} }
try { // Preventing retrieval of currentUser if Outlook is older than 2007
INameSpace mapiNamespace = outlookApplication.GetNameSpace("MAPI"); if (outlookVersion.Major >= 12) {
currentUser = mapiNamespace.CurrentUser.Name; try {
LOG.InfoFormat("Current user: {0}", currentUser); INameSpace mapiNamespace = outlookApplication.GetNameSpace("MAPI");
} catch (Exception exNS) { currentUser = mapiNamespace.CurrentUser.Name;
LOG.Error(exNS); LOG.InfoFormat("Current user: {0}", currentUser);
} catch (Exception exNS) {
LOG.Error(exNS);
}
} }
} }