AddTags Method (IPIPoints2 interface)


This method provides a more efficient method to add multiple tags than adding them individually. New tags and their attributes are specified in the passed NamedValues collection. The collection is a hierarchy where the top level is the name of the tag and below that is a NamedValues collection where the each name is an attribute name and the value contains the new tag attribute's value.



object.AddTags pnvsTagsAndAttributes, Errors, [hList], [pAsynchStatus]


The AddTags method syntax has these parts:

Part Description
object An object expression that evaluates to a IPPoints2 interface.
pnvsTagsAndAttributes NamedValues collection of tags along with attribute names and values used to create each PIPoint.

PIErrors collection.

hList Optional PointList collection that contains the PIPoint objects created.
pAsynchStatus Optional PIAsynchStatus object.

NOTE: Asynchronous operation of this call depends on a future version (later than 3.4.380) of the PI Server.


Trappable Errors

This method can return generic errors (such as Out of Memory, Access Denied, etc.) as well as some errors having to do with the data in pnvsTagsAndAttributes argument.

Error Description
pseNOTAGSFOUND No tags were found in the pnvsTagsAndAttributes argument.


Errors Collection Errors

Errors are that are determined on the PI Server or have to do with inconsistencies in the data in the pnvsTagsAndAttributes argument are returned in the hErrors collection.


Here are some of the errors that can be returned in the errors collection (hErrors). The Source property of each PIError is set to the TagName that generated the error. The Number property of each PIError is set to the error code of the error. The Description property of each PIError is set to the description of the error.


You need to check the errors collection even if the method returns S_OK, since some of the tags may have caused a problem while others were added just fine.


Error Description
pseINVALIDTAGNAME The tagname was invalid.
psePTCLASSNOTFOUND Invalid Point Class.
pseMISSINGPOINTCLASS Point Class missing.
pseINVALIDPOINTTYPE Invalid point type.
pseMISSINGPOINTTYPE Point type missing.
pseATTRTYPECOERCIONFAILED Invalid attribute data type.
Enabling Operational Intelligence