Get all objects in the connector space for a given MA


  • Hi,

    I need to write code to get all the objects in the connector space for a given MA. I'm using some guidance from this link:

    The code I'm using is this

    string managementAgentName = "LyncECMA2";
                ManagementScope mgmtScope = new ManagementScope(@"root\MicrosoftIdentityIntegrationServer");
                SelectQuery query = new SelectQuery("Select * from MIIS_ManagementAgent where name ='" + managementAgentName + "'");
                ManagementObjectSearcher searcher = new ManagementObjectSearcher(mgmtScope, query);
                string guid = string.Empty;
                ManagementObject wmiMaObject = null;
                foreach (ManagementObject obj in searcher.Get())
                    wmiMaObject = obj;
                PropertyDataCollection props = wmiMaObject.Properties;
                foreach (PropertyData p in props)
                    if (p.Name.ToString() == "Guid")
                        guid = p.Value.ToString();
                ManagementScope WMInamespace = new ManagementScope(@"root\MicrosoftIdentityIntegrationServer");
                SelectQuery query2 = new SelectQuery("Select * from MIIS_CSObject where DN=100 and MaGuid='"+guid+"'");
                ManagementObjectSearcher searcher2 = new ManagementObjectSearcher(WMInamespace, query2);
                ManagementObjectCollection CSobjects = searcher2.Get();
                foreach (ManagementObject obj in CSobjects)
                 // How do I retrieve the CS object properties??

    I am able to succesfully connect to the CS object, but I would like to retrieve the attributes of this object now (like firstName, lastName etc). How do I do that?

    I can iterate over obj and use the .Properties collection but that gives me the properties of a MIIS_CSObject whereas I want to access the attributes of the CS Object itself

    • Edited by kmittal82 Tuesday, June 25, 2013 2:18 PM
    Tuesday, June 25, 2013 12:12 PM

All replies

  • Answering my own question here, the .Hologram property of MIIS_CSObject gives an XML representation of the corresponding CS Object which for me is enough to grab hold of the attributes I need to check (for now).

    Surely there must be a simpler way of extracting all the objects associated to a given MA in the connector space though??

    Wednesday, June 26, 2013 8:53 AM