Obtain department information
Command Description
Retrieve department information from enterprise WeChat and return it in array format
Command Prototype
DepartmentArray = WxWork.GetDepartmentList(wxwork_obj, parent_id, recursive)
Command parameter
parameter | mandatory | type | default value | Instructions |
---|---|---|---|---|
wxwork_obj | True | expression | WxWorkObject | Enterprise WeChat object created using the WxWork. Create command |
parent_id | True | string | "" | Specify a department ID to obtain information about the subordinate departments of this department. If specified as empty or an empty string, retrieve department information for the entire enterprise |
recursive | True | boolean | True | Specify whether to include all subordinate departments. If not, only obtain the next level department; If yes, the subordinate departments of the subordinate departments will also be obtained until there are no subordinate departments left |
Return result
Return_array, Assign the result of running the command to this variable.
Run instance
/********************************* Get Department Information **************************************
Command Prototype:
DepartmentArray = WxWork.GetDepartmentList(wxwork_obj, parent_id, recursive)
Input Parameters:
wxwork_obj -- WeChat Work object. Note: WeChat Work object created using the WxWork.Create command.
parent_id -- Parent department. Note: Specify a department ID to get the subordinate department information of this department. If specified as empty or empty string, retrieves department 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 the next level of departments; if yes, also retrieves subordinate departments of subordinate departments, until no more subordinate departments exist.
Output Parameters:
return_array -- Variable to store the output of the function call.
Important Notes:
None
********************************************************************************/
Dim return_array = ""
DepartmentArray = WxWork.GetDepartmentList(WxWorkObject, "", True)
TracePrint(return_array)