When launching an InnoSetup .exe, is it possible to retrieve the current email address logged into Outlook.exe (provided that Outlook is started up and running)? How can one retrieve this value as a string var? Thank you.
Asked
Active
Viewed 155 times
0
-
1I hope you are aware that e-mail addresses are considered as protected personal data within the General Data Protection Regulation (GDPR) in the European Union. This limits your legal possibilities to process e-mail addresses. – Matej Feb 21 '22 at 10:14
-
1What is your goal of retrieving the email address? Isn't better to ask user from the installer to enter the email address? – Eugene Astafiev Feb 21 '22 at 16:35
-
@EugeneAstafiev For a multitude of reasons. One is for a seamless experience, so depending on the email address, the installer would configure a certain way. Additionally, suppose this had credential implications, if user input was warranted then anyone could input someone else's email address. If being used that way I didn't want to go the user input, user password route. Overall, it was just a question to know if it was possible. – StackOverknow Feb 21 '22 at 20:02
-
1Can you be sure that Outlook is always running with a correct profile? – Eugene Astafiev Feb 22 '22 at 10:03
-
1If your users are in an Active Directory environment, if AD has email integration, and if users log on using a domain account, you might be able to use the `mail` attribute of the current user account (but that's a lot of "if's"). If users are home users, are in a domain but the computer is not joined, are logging on using a local (non-domain) account, etc. etc. etc. there is no email address for the user (so far as system APIs are concerned). – Bill_Stewart Feb 22 '22 at 17:38
-
Also: You seem to have the mistaken impression that an AD account's `userPrincipalName` attribute is an email address. It isn't. – Bill_Stewart Feb 22 '22 at 23:40
-
@Bill_Stewart With all due respect Bill, there is a reason why I made separate posts since they are 2 different topics. Why are you making the assumption I am utilizing both for the same purpose. And worse, why do you feel the need to comment on the unrelated post with such arrogance and unrelated advice? If you felt strongly about a topic, post your comment on that post. I also never said the UPN was the email address. I mentioned specifically depending on the organization, setup, etc it may very well be but I never brazenly said it always is the email. – StackOverknow Feb 23 '22 at 16:37
-
No offense was intended; I was trying to educate and prevent wasted time. FWIW, I assumed they were similar questions because your [other question](https://stackoverflow.com/questions/71197576/) stated specifically "the UPN should often return some sort of an email address which I am looking for" and I was trying to explain that this notion is mistaken. – Bill_Stewart Feb 23 '22 at 17:18
1 Answers
1
Use Application.Session.CurrentUser.Address
. In case of an Exchange account, use Application.Session.CurrentUser.AddressEntry.GetExchangeUser().PrimarySmtpAddress
It is not a good idea to connect to a running app from a setup process. I am not sure about InnoSetup, but Windows installer is running as a service, and you won't be able to connect to an out-of-proc COM object (such as Outlook.Application
) if the security contexts do not match (even if the local user is the same).

Dmitry Streblechenko
- 62,942
- 4
- 53
- 78
-
Yes, it's not idea in general. See also [Installing application for currently logged in user from Inno Setup installer running as Administrator](https://stackoverflow.com/q/44575666/850848). – Martin Prikryl Feb 21 '22 at 06:57