PDA

View Full Version : Insert new key into appSettings.config


paxil
03-19-2014, 09:39 AM
I want to be able to add a new key to the appSettings.config file. I can do the write xml and update existing entries no problem, but cannot add new lines? Any help would be much appreciated.

For example:

Before the add:
<appSettings>
<add key="DatasourceConnection" value="server" />
</appSettings>


After New Key added:
<appSettings>
<add key="DatasourceConnection" value="server" />
<add key="LDAPBinding" value="NEW KEY" />
</appSettings>

kinook
03-19-2014, 10:00 AM
You would need to call MSXML directly to insert an element like that.
http://technet.microsoft.com/en-us/magazine/2008.02.heyscriptingguy.aspx

kinook
03-20-2014, 10:27 AM
This is now supported in v8.6. See the attached sample.

paxil
03-20-2014, 03:33 PM
Thanks for the quick response and I'm glad its been added to the latest release because I was having issues with the VB Script method. I will update my post as soon as I upgrade and test this out.
Thanks