Hi All,
Please find the below steps to pass value from Unsecure Plugin Configuration to Plugin Code
<UnSecureConfiguration>
<setting name="GUID1">
<value>131F1519-000-E511-9875-000D3AA0AC11</value>
</setting>
<setting name="GUID2">
<value>1808CB50-17B9-E511-94RE5-000D3000AC11</value>
</setting>
</UnSecureConfiguration>
Plugin C# Code to Retrieve Values from Unsecure Plugin Configuration
private static Guid GetGUID1 = Guid.Empty;
private static string GetGUID2 = null;
private static string GetValueNode(XmlDocument doc, string key)
{
XmlNode node = doc.SelectSingleNode(String.Format("UnSecureConfiguration/setting[@name='{0}']", key));
if (node != null)
{
return node.SelectSingleNode("value").InnerText;
}
return string.Empty;
}
var pluginConfig = string.IsNullOrWhiteSpace(unsecureConfig) ? secureConfig : unsecureConfig;
try
{
if (!string.IsNullOrWhiteSpace(pluginConfig))
{
XmlDocument doc = new XmlDocument();
doc.LoadXml(pluginConfig.ToString());
GetGUID1 = new Guid(GetValueNode(doc, "GUID1"));
GetGUID2 = GetValueNode(doc, "GUID2");
}
}
catch (Exception ex)
{
throw new InvalidPluginExecutionException(ex.Message);
}
Please find the below steps to pass value from Unsecure Plugin Configuration to Plugin Code
<UnSecureConfiguration>
<setting name="GUID1">
<value>131F1519-000-E511-9875-000D3AA0AC11</value>
</setting>
<setting name="GUID2">
<value>1808CB50-17B9-E511-94RE5-000D3000AC11</value>
</setting>
</UnSecureConfiguration>
Plugin C# Code to Retrieve Values from Unsecure Plugin Configuration
private static Guid GetGUID1 = Guid.Empty;
private static string GetGUID2 = null;
private static string GetValueNode(XmlDocument doc, string key)
{
XmlNode node = doc.SelectSingleNode(String.Format("UnSecureConfiguration/setting[@name='{0}']", key));
if (node != null)
{
return node.SelectSingleNode("value").InnerText;
}
return string.Empty;
}
var pluginConfig = string.IsNullOrWhiteSpace(unsecureConfig) ? secureConfig : unsecureConfig;
try
{
if (!string.IsNullOrWhiteSpace(pluginConfig))
{
XmlDocument doc = new XmlDocument();
doc.LoadXml(pluginConfig.ToString());
GetGUID1 = new Guid(GetValueNode(doc, "GUID1"));
GetGUID2 = GetValueNode(doc, "GUID2");
}
}
catch (Exception ex)
{
throw new InvalidPluginExecutionException(ex.Message);
}
No comments:
Post a Comment