Kaspersky Security Center Automation  10.0
HRESULT IKlAkGroups::GetGroupId ( [in] long  nParent,
[in] BSTR  strName,
[out, retval] long *  pnGroupId 
)

Acquire administration group id by its name and id of parent group.

Returns administration group id by id of parent and name.

Parameters:
nParent Id of parent group
strName name of group
Return values:
pnGroupId id of group found and -1 if no group was found.


See JScript sample below.
Following function FindGroupByLongName searches group specified by full subgroups path like "subgroup_of_Groups/subgrup2/subgrup3/group_to_search". Function returns id of found group, if group not found the function returns -1.

	function FindGroupByLongName(oGroups, strFullName)
	{
		oArray = strFullName.split("/");
		nLastGroupId = oGroups.GroupIdGroups;
		for(i = 0; i < oArray.length; ++i)
		{
			if("" == oArray[i])
				continue;
			nLastGroupId = oGroups.GetGroupId(nLastGroupId, oArray[i]);
			if(-1 == nLastGroupId)
			{
				break;
		}; 
	};
		return nLastGroupId;
};