# EssGetGroupList

Description

EssGetGroupList() gets the list of users who are members of a group (or the list of groups to which a user belongs).

Syntax

    ESS_FUNC_M EssGetGroupList (hCtx, GroupName, pCount, ppUserList);

ESS_HCTX_T | hCtx
ESS_STR_T | GroupName
ESS_PUSHORT_T | pCount
ESS_PPUSERNAME_T | ppUserList

Parameters

hCtx | Essbase API context handle.
GroupName | User name or group name.
pCount | Address of variable to receive count of user names.
ppUserList | Address of pointer to receive allocated array of user name strings.

Return Value

If successful, returns a count of user names in pCount, and a array of user name strings in ppUserList.

Notes

- This function can also be used to get the list of groups to which a user belongs, by using a user name as the GroupName argument.
- The memory allocated for ppUserList should be freed using EssFree().

Access

This function requires the caller to have Create/Delete User privilege (ESS_PRIV_USERCREATE) for the logged in server, unless they are a user getting their own list of groups.

Example

    ESS_FUNC_M
    ESS_ListGroupUsers (ESS_HCTX_T  hCtx,
                        ESS_HINST_T hInst
                       )
    {
       ESS_FUNC_M        sts = ESS_STS_NOERR;
       ESS_PUSERNAME_T  UserList = NULL;
       ESS_USHORT_T     ind;
       ESS_USHORT_T     Items;
       ESS_STR_T        GroupName;
       GroupName = "PowerUsers";
        sts = EssGetGroupList (hCtx, GroupName, &Items, &UserList);
       if (!sts)
       {
          if (Items && UserList)
          {
             printf ("\r\n-------%s User List-------\r\n\r\n", GroupName);
             for (ind = 0; ind < Items; ind++)
             {
                 if (UserList [ind])
                    printf ("%s\r\n", UserList [ind]);
             }
             EssFree (hInst, UserList);
          }
          else
             printf ("\r\nUsers list is empty\r\n\r\n");
       }

       return (sts);
    }

See Also

EssAddToGroup()
EssDeleteFromGroup()
EssListGroups()
EssSetGroupList()