Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a few custom settings for my feature that I am creating. I want a way to populate these values on install with some default values. However if needed an admin should be able to change the defaults via powershell. Is this possible? The settings would be at the web applciation level but could saved somewhere else if that would help.

Wictor has Six ways to store settings in SharePoint would any of these meet my needs?

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

Actually you can reach almost any SharePoint object from the PowerShell.

For example, SPWebApplication.Properties can be modified using the following PowerShell code:

$web = Get-SPWeb http://localhost
$webApplication = $w.Site.WebApplication
$webApplication.Properties["xxx"] = "yyy"
$webApplication.Update()

Screenshot:

enter image description here

To set the default values, you can use C# code in Feature Receiver.

Please, note, that for activating WebApplication-scoped feature, as well as for accessing the SPWebApplication.Properties collection, you should have farm administrator permissions.

share|improve this answer
add comment

I think what would work for you is the property bag. Since its accessible via .NET you can write powershell scripts to interact with them accordingly.

http://www.fivenumber.com/understanding-sharepoint-property-bag-settings/

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.