Create a new group in the personal contact list of a specified user.

 

Syntax

function mPersonalContactsAddGroup(iUINOwner: integer; sGroupName: string): integer;

 

Parameters and return values

Parameter

Type

Value

iUINOwner

integer

user unique ID, >0;

sGroupName

string

group name. You can't use control characters; can't be empty.

 

Function result

>0

no errors, a group created successfully, the result = group ID;

-1

group with such name already exists in a user's personal contact list;

-2

group name can't be empty or consist of spaces;

-3

invalid user UIN;

-4

group name is too long (by default,a limitation is 255 characters by default);

-5

group name has forbidden characters (CRLF, control unprintable UNICODE or ASCII characters);

-6

group owner UIN can't be 0 (built-in bot);

 

Example


const
  UIN_OWNER  = 6;
  GROUP_NAME = 'First group';
var
  iGroupID: integer;
  sMsg: string;
begin
  iGroupID := mPersonalContactsAddGroup(UIN_OWNER, GROUP_NAME);
   
    case iGroupID of
      -1: sMsg := 'group with this name is already exists';
      -2: sMsg := 'group name cannot be empty';
      -3: sMsg := 'owner uin does not exist';
      -4: sMsg := 'group name is too long';
      -5: sMsg := 'group name has invalid characters';
      -6: sMsg := 'you can''t use UIN = 0';
       else begin
         sMsg := 'all ok, GroupID = ' + IntToStr(iGroupID);
         mPersonalContactsRefresh(UIN_OWNER);
       end;
     end;
        
  mLogScript(sMsg, '');  
end.


Script work result

[18:06:19] (Log "mPersonalContactsAddGroup"): all ok, GroupID = 1203

[18:06:19] (Run "mPersonalContactsAddGroup"): Script operation time: 16 ms

 

[18:06:19] (Run "mPersonalContacsAddGroup"): Script done successfully.

 

See also

mPersonalContactsRefresh

IntToStr

mLogScript