Using app.config with add-in for outlook

Add-in Express™ Support Service
That's what is more important than anything else

Using app.config with add-in for outlook
Can this be added to the documentation 
peter maddin




Posts: 28
Joined: 2008-08-26
I need to use app.config with Add-in Express for outlook.
Had a few issues perhaps you could add this to your FAQ or documentation.
I had a look at the forum and managed to piece together what I needed to do.

Steps
1. Add application configuration file to my add-in project
2. Edited configuration file and added <connectionStrings> and <appSettings> sections
3. Picked up settings in AddinInitialize event handler

private void AddinModule_AddinInitialize(object sender, EventArgs e)
{
var DataBaseConnections = ConfigurationManager.ConnectionStrings;

ConnectionString = DataBaseConnections ["ConnStr"].ConnectionString;

NameValueCollection settings = ConfigurationManager.AppSettings;

TempFileName = settings["TempFileName"];
}

4. Set app.config to "Copy Always " for Copy To Output Directory

5. In setup project added app.config to adxloader.dll.manifest

Seems to work ok. Is this the best way to do this or is there a better way?

Posted 19 Sep, 2008 00:37:31 Top
Eugene Astafiev


Add-in Express team


Posts: 8540
Joined: 2007-07-25
Hello Peter,

Thank you for the suggestion.

You would better move the code from the AddinInitialize event handler to the AddinStartupComplete event handler.
.NET, Extended MAPI, Windows Phone & RT
Posted 19 Sep, 2008 07:50:17 Top
peter maddin




Posts: 28
Joined: 2008-08-26
Ok Thanks

Will do
Posted 22 Sep, 2008 02:45:59 Top
Eugene Astafiev


Add-in Express team


Posts: 8540
Joined: 2007-07-25

You are welcome, Peter.
.NET, Extended MAPI, Windows Phone & RT
Posted 22 Sep, 2008 05:16:39 Top