Hi there,
Below is the Helper library project that I have created to access the values from the SSO in BizTalk.
ConfigurationPropertyBag.cs:-
using Microsoft.BizTalk.SSOClient.Interop;
namespace SAT.Common.SSOClient
{
public class ConfigurationPropertyBag : IPropertyBag{private HybridDictionary properties;internal ConfigurationPropertyBag(){properties = new HybridDictionary();}public void Read(string propName, out object ptrVar, int errLog){ptrVar = properties[propName];}public void Write(string propName, ref object ptrVar){properties.Add(propName, ptrVar);}public bool Contains(string key){return properties.Contains(key);}public void Remove(string key){properties.Remove(key);}}
}
SSOClient.cs:-
using System;
using Microsoft.BizTalk.SSOClient.Interop;
namespace SAT.Common.SSOClient
{
public class SSOClient
{
private string idenifierGUID = "ConfigProperties";
/// <summary>
/// Read method helps get configuration data
/// </summary>
/// <param name="appName">The name of the affiliate application to represent the configuration container to access</param>
/// <param name="propName">The property name to read</param>
/// <returns>
/// The value of the property stored in the given affiliate application of this component.
/// </returns>
public string Read(string appName, string propName)
{
try
{
SSOConfigStore ssoStore = new SSOConfigStore();
ConfigurationPropertyBag appMgmtBag = new ConfigurationPropertyBag();
((ISSOConfigStore)ssoStore).GetConfigInfo(appName, idenifierGUID, SSOFlag.SSO_FLAG_RUNTIME, (IPropertyBag)appMgmtBag);
object propertyValue = null;
appMgmtBag.Read(propName, out propertyValue, 0);
return (string)propertyValue;
}
catch (Exception e)
{
throw e;
}
}
}
}
SSOInstanceClient.cs:-
namespace SAT.Common.SSOClient
{
/// <summary>
/// This class is created for Map purposes.
/// </summary>
public class SSOInstanceClient
{
public string Read(string appName, string propName)
{
var SSOClientobj = new SSOClient();
return SSOClientobj.Read(appName, propName);
}
}
}
SSOStaticClient.cs:-
using System;
namespace SAT.Common.SSOClient
{
/// <summary>
/// This class is created for Orchestration purposes. The class needs to be Serialized
/// </summary>
[Serializable]
public static class SSOStaticClient
{
public static string Read(string appName, string propName)
{
var SSOClientobj = new SSOClient();
return SSOClientobj.Read(appName, propName);
}
}
}
Usage in the Orchestration:-
strKeyValue = SAT.Common.SSOClient.SSOStaticClient.Read("YourSSOAppName", "YourKey")
Have a great day.