Adding a server to a group

Once you have the ServerGroup object that controls the group you want to add servers to, you can use the ServerGroup.Servers.Add method. The method takes one parameter, the name of the server you want to add (see Getting servers connected to the APS for information on retrieving a server ID). For example, the following function adds a server to a given group. Once the server has been added, you must call InfoStore.Commit to save the changes to the APS.

Example

function AddServerGroupMember(IStore, ServerGroupId, ServerName)

{

    var ServerGroups = IStore.Query

    ("SELECT SI_GROUP_MEMBERS FROM CI_SYSTEMOBJECTS WHERE SI_ID="+ServerGroupId);

    ServerGroup = ServerGroups.Item(1).PluginInterface("");

    ServerGroup.Servers.Add(ServerName);

    IStore.Commit(ServerGroups);

}

Next: Removing a server from a group.



Crystal Decisions, Inc.
http://www.crystaldecisions.com
Support services:
http://support.crystaldecisions.com