Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can an Outlook addin write to the system event log?

I have an outlook add-in developed with VSTO 2010 that I want to write some event logging. While debugging I can get this to work by simply 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 version the add-in doesn't have admin rights to read the log. I found some articles that talked about creating the EventLog source during installation, but I'm using ClickOnce and it doesn't seem there is a way to do that. Also, someone talked about creating a separate DLL and then call InstallUtil on that DLL to create the source. This doesn't work for me either since this still requires admin rights.

Is it possible to have the add-in run using Outlook's security level? I see Outlook's messages in the event log so it must have enough rights to do so.

like image 641
user1715925 Avatar asked Nov 17 '12 00:11

user1715925


People also ask

What do add-ins do in Outlook?

Add-ins in Outlook.com are programs or utilities that help you automate tasks when you view or create messages. Microsoft has partnered with leading companies to build add-ins that help you get things done right from your inbox.

Can Windows event logs be modified?

Under the Collection tab, double-click on the selected Log Source or just select it and click the Edit button. The Windows Events Log Source Edition tab is displayed. Click ON or OFF to define whether the current Log Source is enabled or disabled.

What is System event log?

The Windows event log is a detailed record of system, security and application notifications stored by the Windows operating system that is used by administrators to diagnose system problems and predict future issues.


1 Answers

You can try to run click once as administrator using the solution proposed in this article but I don't think it's a good solution.

Maybe a better solution is to include in your click once package a standard .msi setup that you can execute the first time you install your addin. This msi just create the event source.

About your question:

Is it possible to have the add-in run using Outlook's security level?

I don't think that your add-in run using a different security level but probably you have UAC enabled so you cannot execute admin operations also if you are an administrator.

like image 71
Davide Icardi Avatar answered Sep 25 '22 10:09

Davide Icardi