Add Method (PIUsers collection)

               

 

The Add method creates a new PIUser object and attaches it to the Server.PIUsers collection. The method returns a reference to the PIUser object created.

Syntax

object.Add Name, Description, Password, Groups, Context

The Add method syntax has these parts:

Part Description

object

An object expression that evaluates to a PIUsers collection obtained from a Server object.

Name

A string representing the name for the new user.

Description

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

Groups

A NamedValues collection containing names of user groups to which the new user should belong. The names can be obtained from the Server.PIGroups collection on the server.  The value portion of each NamedValue in the collection is ignored.

Password

A string containing the password for the new user.

Context

An optional string containing the name of a PIContext to associate with the new user. A list of current contexts can be obtained from the Server.PIContexts collection.

Remarks

Adding a user to the server will only succeed if the caller has write access to the user database on the server. This access is controlled through server specific means to maintain an environment with the desired level of security.

 

Trappable Errors

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

Error Description

pseACCESSDENIED

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

pseNOEMPTYSTRINGS

The user name may not be blank.

pseCONTEXTNOTFOUND

The passed context string does not exist on the server.

pseUSEREXISTS A user by this name already exists on the server.
pseUSERINSTANTIATE Unable to create a PIUser object in memory. May be out of memory.

psePIUSEROBJCREATE

Unable to create a PIUser on the server.
pseGROUPNOTFOUND One of the groups passed does not exist. See the error description for more information.

Enabling Operational Intelligence