Send a message to employees in the department
Command Description
Send text messages, pictures, files, and other messages to each employee in the designated department
Command Prototype
DingTalk.SendToDepartment(DingTalk_obj, department, message)
Command parameter
parameter | mandatory | type | default value | Instructions |
---|---|---|---|---|
DingTalk_obj | True | expression | DingTalkObject | The DingTalk object created using the DingTalk. Create command |
department | True | number | one | Send work notifications to every employee in the designated department; It can be one department or multiple departments. If it is one department, please specify the department ID here, which defaults to 1 and represents sending work notifications to all employees of the enterprise; If there are multiple departments, please use an array to represent them. Each element in the array is a department ID, with a maximum of 20 elements |
message | True | string | "" | Specify the message to be sent. Can be a string representing sending a text message; It can also be images, files, and other messages created previously using commands such as DingTalk. CreateImageMessage/DingTalk. CreateFileMessage |
Return result
Run instance
/********************************* Send Message to Employees in Department **********************************
Command Prototype:
DingTalk.SendToDepartment(DingTalk_obj, department, message)
Input Parameters:
DingTalk_obj -- DingTalk object. Note: DingTalk object created using the DingTalk.Create command.
department -- Department ID. Note: Send work notifications to each employee in the specified department(s). Can be a single department or multiple departments. If a single department, specify the department ID here (default is 1, representing sending to all employees in the enterprise). If multiple departments, represent as an array where each element is a department ID, with a maximum of 20 elements.
message -- Message to send. Note: Specify the message to be sent. Can be a string representing text message, or can be image/file messages previously created using DingTalk.CreateImageMessage/DingTalk.CreateFileMessage commands.
Output Parameters:
None
Important Notes:
None
********************************************************************************/
DingTalk.SendToDepartment(DingTalkObject, 1, "")