Adding a server group

Adding a server group is done in much the same way as you add any other type of InfoObject, for example, a user account.

To add a group
  1. Retrieve the plugin manager.
  2. Retrieve the ServerGroup plugin using the PluginInfo property of the PluginManager.
  3. Create a new InfoObjects collection.
  4. Add the ServerGroup plugin to this collection.
  5. From the new collection, retrieve the ServerGroup object using the PluginInterface.
  6. Set the desired properties. In this case the title and the description.
  7. Commit the collection that includes the new group to the APS.

The following function adds a new group to the APS:

function AddServerGroup(IStore, Name, Description)

{

    var PluginMgr = IStore.PluginManager;

    // Get the ServerGroup.

    var ServerGroup = PluginMgr.PluginInfo("CrystalEnterprise.ServerGroup");

    // Create a new InfoObjects collection. This will be used to store the new object

    // that will be commmitted later.

    var NewInfoObjects  = IStore.NewInfoObjectCollection();

    // Add the result of the plugin. This will create a new InfoObject that

    // represents a ServerGroup.

    var NewServerGroup = NewInfoObjects.Add (ServerGroup);

    // Set the group's name and description.

    NewServerGroup.Title = Name;

    NewServerGroup.Description = Description;

    // Commit the collection, in which the new group is stored, to the APS.

    IStore.Commit (NewInfoObjects);

}

Next: Removing a server group.



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