Quantcast
Channel: Microsoft Identity Manager forum
Viewing all articles
Browse latest Browse all 7443

Get all objects in the connector space for a given MA

$
0
0

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:

http://social.technet.microsoft.com/Forums/en-US/a54b1c47-6905-4cfd-b3af-cf3b375b6ece/whats-the-best-way-to-get-all-objects-within-the-connector-space-in-c

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


Viewing all articles
Browse latest Browse all 7443

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>