Thanks for the replies, they do help.
For anyone else looking to answer this question:
I came to believe the unique name of a tag is "profileName::stereotypeName::tagName"
So my method for adding / updated the tag of an EA.Element is:
//
https://sparxsystems.com/forums/smf/index.php?topic=6097.0 public static bool addTaggedValue(EA.Element elementParam, string profileName, string stereotypeName, string tagName, string value)
{
String tagId = profileName + "::" + stereotypeName + "::" + tagName;
TaggedValue tag = elementParam.TaggedValues.GetByName(tagId);
if (tag == null)
{
TaggedValue element = elementParam.TaggedValues.AddNew(tagName, value);
element.Value = value;
element.Update(); //must be executed in order to save new tagged value
return true;
}
tag.Value = value;
tag.Update();
return false;
}
For EA.Attribute and other EA.element types I needed another version with exactly the same code but replacing EA.Element with EA.Attribute. Could not find a way to generalise EA.Element and EA.Property!