Remember SAFEARRAY and VARIANT ??? The AzMan API exposes some of its info in exactly these data types.
e.g. if you want to get a list of members of an application group you grab the Members property of the IAzApplicationGroup object.
Members is a VARIANT datatype which wraps a SAFEARRAY which in turn wraps the members of the application group.
Took me some time to figure out how to handle that in C#. so i thought i share the code with you…
public string[] GetApplicationGroupMembers(string ApplicationGroup)
{
foreach (IAzApplicationGroup appGroup in app.ApplicationGroups)
{
if (appGroup.Name == ApplicationGroup)
{
System.Array memberArray = (System.Array)appGroup.Members;
string[] members = new string[memberArray.GetLength(0)];
for (int i = 0; i < memberArray.Length; i++)
members[i] = Convert.ToString(memberArray.GetValue(i));
return members;
}
}
throw new Exception(“Application Group not found”);
}
