MyChat Scripts Engine: mGetDepartmentTextPathByID, full path in the common contact list by department's ID
Getting full path name to the specified group (department) from the common tree-like contact list by its numeric identifier.
Syntax
function mGetDepartmentTextPathByID(iID: integer): string;
Parameters and return values
Parameter |
Type |
Value |
iID |
integer |
numeric identifier of a group in MyChat Server common contact list. |
Function result
Full path from the root. Group names are separated by the backslash symbol ("\"). If the common contact list is empty or group identifier does not exist, the function returns an empty string.
Example
const
iUIN = 6;
var
iUserDeptID: integer;
sPath, sUserDisplayName: string;
begin
iUserDeptID := mGetUserDepartmentID(iUIN);
if iUserDeptID > 0 then begin
sPath := mGetDepartmentTextPathByID(iUserDeptID);
sUserDisplayName := mGetUserAttribute(iUIN, 'DisplayName');
mLogScript('User "' + sUserDisplayName + '" UIN ' + inttostr(iUIN) + ' is in the "' + sPath + '" group of common contacts', '');
end else mLogScript('User "' + sUserDisplayName + '" UIN ' + inttostr(iUIN) + ' isn''t in the common contacts list', '');
end.
Script work result
[15:26:34] (Log "mGetDepartmentTextPathByID"): User "Alexey Pikurov" UIN 6 is in the "MyChat\Teamleads developers" group of common contacts
[15:26:34] (Run "mGetDepartmentTextPathByID"): Script operation time: 7 ms
[15:26:34] (Run "mGetDepartmentTextPathByID"): Script done successfully.