Hello All,
From a C# program I am able to change Metadata categories if the template has only one level of information as StringValues.
However for certain templates for attribute group like "General Information" , the string metadata that we want to update is nested deep within as DataValue - RowValue - StringValue.
And the DataValue does not have a property "Values".
Please suggest how to iterate through the metadata heirarchy and access the StringValue.
Example Key - 3904518.103.5.6.
Code Snippet -
AttributeGroup genInfoCategoryTemplate = null;
genInfoCategoryTemplate = docMan.GetCategoryTemplate(ref otAuthDocMan, Convert.ToInt32(AppConstants.GenInfoCatID));
DataValue intPartyName = genInfoCategoryTemplate.Values[0] as DataValue;
//StringValue intPartyName = genInfoCategoryTemplate.Values[0] as StringValue;//This is always null as values[0] is a DataValue type.
I need to fill the esixiting node value if we do not have a new value for the attribute. As am trying in the code below. I am not able to iterate beyond the first two levels of nesting as there is no Values property beyond this point. The below code works fine if there is only one level of attributes and StringValue.
if (intPartyName.values == null)
{
var intPartyAttribute = (node.Metadata.AttributeGroups.Where(a => a.DisplayName == "1. General Information").ToArray())
[0].Values.Where(d => d.Description == "Internal Party Name").ToArray();
if (((StringValue)intPartyAttribute[0]).Values != null)
intPartyName = new string[] { ((StringValue)intPartyAttribute[0]).Values[0].ToString() };
}
Any immediate Help in this matter would be highly appreciated as I am racing against time to sort this.