Skip to main content
Version: v6.5.0

Obtain employee information within the department

Command Description

Obtain the information of employees in the department based on the department ID and return it in the form of an array

Command Prototype

UserInfoArray = DingTalk.GetUserList(DingTalk_obj, department_id, recursive, simple_info)

Command parameter

parametermandatorytypedefault valueInstructions
DingTalk_objTrueexpressionDingTalkObjectThe DingTalk object created using the DingTalk. Create command
department_idTruenumberoneThe designated department ID, if specified as 1, retrieves employee information for the entire enterprise
recursiveTruebooleanTrueSpecify whether to include all subordinate departments. If not, only obtain the information of direct employees in the current department; If yes, employee information from subordinate departments will also be obtained
simple_infoTruebooleanTrueDo we only need to obtain basic information. If yes, only basic information such as employee name and ID will be included; If not, it will also include the employee's phone number, email, and other information, but it requires a relatively high level of permission

Return result

Return_array, Assign the result of running the command to this variable.

Run instance

/********************************* Get Employee Information in Department *********************************
Command Prototype:
UserInfoArray = DingTalk.GetUserList(DingTalk_obj, department_id, recursive, simple_info)
Input Parameters:
DingTalk_obj -- DingTalk object. Note: DingTalk object created using the DingTalk.Create command.
department_id -- Department ID. Note: Specified department ID. If specified as 1, retrieves employee information for the entire enterprise.
recursive -- Include all subordinate departments (including sub-subordinate departments). Note: Specifies whether to include all subordinate departments. If no, only retrieves direct employee information of the current department; if yes, also retrieves employee information from subordinate departments.
simple_info -- Retrieve only basic information. Note: Whether to retrieve only basic information. If yes, only includes basic information such as employee name and ID; if no, also includes employee phone numbers, email addresses, etc., but requires higher permissions.
Output Parameters:
return_array -- Variable to store the output of the function call.
Important Notes:
None
********************************************************************************/
Dim return_array = ""
UserInfoArray = DingTalk.GetUserList(DingTalkObject, 1, True, True)
TracePrint(return_array)