AddItems Method (IPointList2 interface)



Adds specified items to a PointList.



object.AddItems items, errors


The AddItems method syntax has these parts:




An object expression that evaluates to a IPointList2 interface.


A VARIANT. This is described under Remarks below.


PIErrors collection. This is described under Remarks below.



This call provides a simple and efficient mechanism to add tags to an existing PointList.

The item argument can be any of the following VARIANT types:

AddItems returns a collection of PIError objects containing detailed information about tags that were not added to the PointList. The Description field of each PIError object contains the full name of the tag and the reason/error is stored in the Number field. The possible reason codes are listed in the table below.


Performance and usage notes

The performance is mainly affected by the number of calls made to the server. Tags that already exist in the server's PIPoints collection don't require network calls so they can be added very efficiently. It is better to pass arrays or PointLists in order to minimize the calls across the COM layer.

It is important to notice that the lookup from the server's point cache is omitted for tagname arrays because this would lead to a server/network call for each tag that was not found. To avoid multiple calls, AddItems creates a SQL query and makes a single call to a server to retrieve the tags (PI3 servers only).


Trappable Errors

In addition to generic errors (such as Out of Memory), the following errors may occur:

Error Description
DISP_E_TYPEMISMATCH Unsupported input VARIANT type or if the input is a VARIANT array and items are different VARIANT types.
PISDK.Servers (multiple) Any error that may occur when accessing the PISDK.Servers collection


Errors returned in the PIErrors collection

The following errors or statuses may be returned:

Error Description
pseDUPLICATENAME Item already in the list.
pseINVALIDTAGNAME Tag name (format) is invalid
psePIPOINTNOTFOUND PIPoint not found in the server
pseSERVERNOTFOUND Server not defined in known servers table
Server access Any error that may occur when opening a connection or accessing server.

Enabling Operational Intelligence