How to set/get configuration settings from PowerEventReceivers ?

Nov 18, 2009 at 6:25 AM

Since the script will be executed in PowerShell, how could I read my configuration settings (like connectionStrings) which is normally stored in web.config under the SharePoint web root ?

Thanks !

Coordinator
Nov 18, 2009 at 8:13 AM

Hello,

you can simply define variables like

$setting1 = "Data Source=...."

because the script itself is stored

or store your configs in the property bag on the web.

$web.Properties["setting1"] = "....."

$web.Properties.Update() 

or on the Web Application level

$bag = $site.WebApplication.Properties

$bag["setting1"] ="jkjkjkj"

$bag.Update()

 

bye,christian

 

Nov 19, 2009 at 4:29 AM

Hi Christian,

"$web.Properties.Update()" works well as what I need. But I could not find an "Update" method on "site.WebApplication.Properties", am I wrong or there is another method ?

 

Thanks,

Willian.