Related Topics
Group Class
This object represents a group of users.
Properties
PROPERTY NAME |
DATA TYPE |
DESCRIPTION |
---|---|---|
GID |
String |
The internal ID of the group |
GroupName |
String |
The unique string to identify the group |
Users |
List Object |
The list of users which belong to the group, returned as a List<User>. |
Methods


This API adds the specified user to the group. If the user is already in the group, a note of that will be made in the logs, but the function won't add a duplicate user to the group. This is an overloaded method with the following possible declarations:
public void AddUser(User User)
public void AddUser(string UID)
Parameters
UID: The ID of the user to add to the group
User: The actual user object to add to the group
Returns
None
Example
var oUser = User.GetUserByUserID(bp, "User 1");
var oGroup = Group.GetGroupByName(bp, "Group 1");
// The following two calls do the same thing
// (add "User 1" to "Group 1")
oGroup.AddUser(oUser); // Call with the User object
oGroup.AddUser(oUser.UID); // Call with the User ID


This API will remove the Group from the system.
Parameters
BP: The BP Logix environment.
GroupName: The string name of the group to delete.
Returns
Boolean: Returns false of the operation fails.
Example
bool deleted = DeleteGroup(bp, "GroupName");


This API will get a group object from the specified name.
Parameters
BP: The bp environment
Name: The name of the group to retrieve
Returns
Group: A Group object representation of the group
Example
// Get the group named "Group 1"
var oGroup = Group.GetGroupByName(bp, "Group 1");
// Get a list of the users in "Group 1"
var Users = oGroup.Users;


This API checks if the specified user exists in the group. In some situations, it may be more efficient to view the list of groups to which a specific user belongs, using the User.Groups property. This is an overloaded method with the following possible declarations:
public bool HasUser(User User)
public bool HasUser(string UID)
Parameters
UID: The ID of the user to test in the group
User: The actual user object to test in the group
Returns
True/False: Whether or not the specified user exists in the group
Example
var oUser = User.GetUserByUserID(bp, "User 1");
var oGroup = Group.GetGroupByName(bp, "Group 1");
// The following two conditional tests test the same thing
// (is "User 1" in "Group 1")
if(oGroup.HasUser(oUser))
{
// Do action
}
// OR
if(oGroup.HasUser(oUser.UID))
{
// Do action
}


This API will convert a comma-separated string or DataItem containing a list of Groups into a normalized List object. This is an overloaded method with the following possible declarations:
public static List<Group> NormalizeGroupList(bp BP, string pGroupList)
public static List<Group> NormalizeGroupList(bp BP, string pGroupList,
bool ReturnNullOnInvalid)
public static List<Group> NormalizeGroupList(bp BP, ref DataItem pGroups)
public static List<Group> NormalizeGroupList(bp BP, ref DataItem pGroups,
bool ReturnNullOnInvalid)
Parameters
BP: The BP Logix environment.
pGroupList: A string containing a comma-separated list of groups.
pGroups: A DataItem object containing a list of groups.
ReturnNullOnInvalid: A boolean value specifying whether to return a null List object if the list is invalid.
Returns
List: A List object containing the groups.
Example
var groupList = NormalizeGroupList(bp, "Group1,Group2,Group3");


This API will remove the specified user from the group. This is an overloaded method with the following possible declarations:
public void RemoveUser(User User)
public void RemoveUser(string UID)
Parameters
UID: The ID of the user to remove from the group
User: The actual user object to remove from the group
Returns
None
Example
var oUser = User.GetUserByUserID(bp, "User 1");
var oGroup = Group.GetGroupByName(bp, "Group 1");
oGroup.RemoveUser(oUser);
Documentation Feedback and Questions
If you notice some way that this document can be improved, we're happy to hear your suggestions. Similarly, if you can't find an answer you're looking for, ask it via feedback. Simply click on the button below to provide us with your feedback or ask a question. Please remember, though, that not every issue can be addressed through documentation. So, if you have a specific technical issue with Process Director, please open a support ticket.