Reputation: 5
I have a requirement where I have to write a value to the SSO store during run time. I found a lot of blogs about reading from the SSO but having no luck in finding a blog that talks about writing to the SSO during run time.
Upvotes: 0
Views: 152
Reputation: 11527
What you need is a method to call ISSOConfigStore.SetConfigInfo(String, String, IPropertyBag) Method added to the helper class for SSO
The below code as per T Hemani's/theman post on MSDN/Technet
public static void Write(string appName, string propName, string propValue)
{
try
{
ISSOConfigStore configStore = (ISSOConfigStore)new SSOConfigStore();
ConfigurationPropertyBag appMgmtBag = new ConfigurationPropertyBag();
object tempProp = propValue;
try
{
appMgmtBag.Remove(propName);
}
catch { }
appMgmtBag.Write(propName, ref tempProp);
configStore.SetConfigInfo(appName, idenifierGUID, (IPropertyBag)appMgmtBag);
}
catch (Exception e)
{
System.Diagnostics.Trace.WriteLine(e.Message);
throw;
}
}
Upvotes: 0