AzMan Addendum

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”);
}

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s