Getting a department name from the common contact list by user identifier (UIN).
function mGetUserDepartmentName(iUIN: integer): string;
Parameter |
Type |
Value |
---|---|---|
iUIN |
integer |
unique user identifier. |
Group name. If the common contact list is empty, user UIN does not exist or not located in the common contact list — the function returns an empty string.
var
i, iMax: integer;
s, sName: string;
begin
iMax := mGetMaxRegisteredUIN;
s := '';
for i := 1 to iMax do
if mIsUINExists(i) then begin
sName := mGetUserDepartmentName(i);
if length(sName) > 0 then begin
s := s +
'User UIN ' + inttostr(i) +
', Name: "' + mGetUserAttribute(i, 'DisplayName') + '" ' +
'is in common contacts list, group : "' + sName + '"' +
CRLF;
end;
end;
if length(s) > 0 then mLogScript(s, '')
else mLogScript('Common contacts list is empty!', '');
end.
[11:48:05] (Log "mGetUserDepartmentName"): User UIN 3, Name: "Andrew Rakov" is in common contacts list, group : "Teamleads"
User UIN 6, Name: "Alexey Pikurov" is in common contacts list, group : "Sales department"
User UIN 5454, Name: "Notebook Acerov" is in common contacts list, group : "Bookkeeping"
User UIN 15427, Name: "Heorhii Lysenko" is in common contacts list, group : "MyChat developers"
[11:48:05] (Run "mGetUserDepartmentName"): Script operation time: 703 ms
[11:48:05] (Run "mGetUserDepartmentName"): Script done successfully.