Can Outlook add an entry to the system event log?

I have an Outlook add-in developed with VSTO 2010 that I want to write in the event log. During debugging, I can get this to work just by doing the following:

if (!EventLog.SourceExists(ADDIN_FRIENDLY_NAME)) { EventLog.CreateEventSource(ADDIN_FRIENDLY_NAME, null); } EventLog.WriteEntry(ADDIN_FRIENDLY_NAME, message, EventLogEntryType.Warning); 

The problem is the release of the version, the add-in does not have administrator rights to read the log. I found some articles that talked about creating an EventLog source during installation, but I'm using ClickOnce, and there seems to be no way to do this. In addition, someone talked about creating a separate DLL, and then calls InstallUtil in that DLL to create the source. This does not work for me, as it still requires administrator rights.

Can I run an add-in using the Outlook security level? I see Outlook messages in the event log, so it should have sufficient rights for this.

+7
source share
1 answer

You can try to run the click once as an administrator using the solution suggested in this article , but I don't think this is a good solution.

Maybe the best solution is to include the standard .msi setting in your package once, which you can do the first time you install your add-on. This msi just creates an event source.

About your question:

Can I run an add-in using the Outlook security level?

I do not think that your add-in is launched using a different level of security, but it is possible that you have UAC enabled, so you cannot perform operations with an administrator if you are an administrator.

+1
source

All Articles