DefaultUser Property (Server object)



A Read/Write string property that contains the name of the currently configured default user for this server. When a Server is opened with an empty connection string or with a string that does not contain the UID keyword, the default user property is used in establishing the connection. Each workstation will have a default user configured for each server, established when the server is initially added to the Known Servers Table. Each workstation user may additionally have an overriding default user on any configured server. This override is set by this property and may be removed with the RemoveDefaultUser method.



The object placeholder is an object expression that evaluates to a Server object.


When setting the DefaultUser property, the set value is considered user specific. It then overrides the workstation DefaultUser property established when the Server was added to the Known Servers Table. For example, if server UNIT1 was established with a default user of “maintenance”, a program being run by the workstation user Bob (NT or Windows 98 logon name) could set the DefaultUser property to “utility”. From that point on, whenever user Bob opened a connection to server UNIT1 and did not specify a user in the connection string, the user name “utility” would be used. Other users on the same workstation opening connections to server UNIT1 without specifying a specific user name would be connected with user “maintenance”. You can remove this user-specific override by calling RemoveDefaultUser. To modify the common DefaultUser property, the Server must be removed and added back to the Known Servers Table using Servers.Remove and Servers.Add.

When this property changes, the OnEdit event is fired.


Against PI2 systems the Server.CurrentUser and the PIUser objects in the Server.PIUsers collection may not match the DefaultUser property after a Server.Open.  See the Server.CurrentUser documentation for details.



Enabling Operational Intelligence