A small update on this one: the ArchiMate namespace prefix has to be present in order to resolve ambiguity. From an OO perspective, this is a common approach.
With an Archimate Function, there is no problem:
(1) elements.AddNew( "XYZ", "ArchiMate::Function" );
(2) elements.AddNew( "XYZ", "Function" );
will produce the same result, an ArchiMate Function for (1) and (2)
However, there is a problem with an ArchiMate Component:
(3) elements.AddNew( "XYZ", "ArchiMate::Component" );
(4) elements.AddNew( "XYZ", "Component" );
will produce a different result: an Archimate Component for (3), but a UML component for (4)
Adding a stereotype does not help:
(5) elements.AddNew("XYZ", "Component", "ArchiMate_Component" );
(6) elements.AddNew("XYZ", "Interface", "ArchiMate_Interface" );
will get you a UML Component (5) / Interface (6), that is stereotyped as an ArchiMate one. This is not wat you want.
To be in sync with elements / connectors that you drag & drop from the toolbox, use the stereotype in combination with the namespace prefix:
(7) elements.AddNew("XYZ", "ArchiMate::Component", "ArchiMate_Component" );
(

elements.AddNew("XYZ", "ArchiMate::Interface", "ArchiMate_Interface" );
will produce the expected results.
Regards,
Rudi