Add Method (PIContexts collection)

                

 

Creates a new PIContext object and attaches it to the Server’s PIContexts collection. Returns a reference to the PIContext object created.

 

Syntax

object.Add Name, Description

The Add method syntax has these parts:

Part

Description

object

An object expression that evaluates to a PIContexts collection.

name

A string representing the new context.

description

A string containing a description to be associated with the new context.

 

Remarks

Only PIContext objects stored on the server may be associated with a PIUser. To create a PIUser with a new context, or change a PIUser's DefaultContext property to a new context, the context must first be created with this method.

 

Trappable Errors

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

Error

Description

pseNOEMPTYSTRINGS

The context name must be non blank.

pseCONTEXTINSTANTIATE

Problem creating the internal object in memory to represent the new PIContext.

psePICONTEXTOBJCREATE

Failed to create the new PIContext on the server.

pseACCESSDENIED

Caller does not have sufficient privilege to add a new PIContext.

Enabling Operational Intelligence