Search for employees by name
Command Description
Search for employees whose names match exactly. Return employee IDs in array format
Command Prototype
UserIdArray = WxWork.FindUser(wxwork_obj, user_name, parent_id)
Command parameter
parameter | mandatory | type | default value | Instructions |
---|---|---|---|---|
wxwork_obj | True | expression | WxWorkObject | Enterprise WeChat object created using the WxWork. Create command |
user_name | True | string | Zhang San | The complete name of the employee to be searched can be one employee or multiple employees. If there are multiple employees, please use an array to represent them, where each element in the array is an employee to be searched for |
parent_id | True | string | "" | Specify a department ID to search for all subordinate departments (including subordinate departments of subordinate departments) within this department. If specified as empty or empty string, search for all departments in the entire enterprise |
Return result
Return_array, Assign the result of running the command to this variable.
Run instance
/********************************* Find Employee by Name ************************************
Command Prototype:
UserIdArray = WxWork.FindUser(wxwork_obj, user_name, parent_id)
Input Parameters:
wxwork_obj -- WeChat Work object. Note: WeChat Work object created using the WxWork.Create command.
user_name -- Employee name. Note: The full name of the employee(s) to search for. Can be a single employee or multiple employees. If multiple employees, represent as an array where each element is an employee to search for.
parent_id -- Parent department. Note: Specify a department ID to search within all subordinate departments (including sub-subordinate departments) of this department. If specified as empty or empty string, searches across all departments in the entire enterprise.
Output Parameters:
return_array -- Variable to store the output of the function call.
Important Notes:
None
********************************************************************************/
Dim return_array = ""
UserIdArray = WxWork.FindUser(WxWorkObject, "张三", "")
TracePrint(return_array)