MIM 2016 ECMA: How to access CSEntry’s attributes from PutExportEntries

Use Case

My DN for the ECMA is Attrib1. The unique identifier of the remote object is Attrib2. The remote directory will only accept Attrib2 as an identifier much like Get-Aduser in AD will only accept specific attributes (DN,Samaccountname etc) as the query identifier. So the question is now how do I get Atrrib2 from the csentry during export?

During Export the DN is readily available but by default only attributes with changed values are present in the table for “ChangedAttributeNames”. I want Attrib2 to always be present so I can read it.

There is another export table called “AttributeChanges” which can contain all attributes of the object if you do the following

Update the MA Capabilities

Set the Export Type to ObjectReplace

myCapabilities.ExportType = MAExportType.ObjectReplace;

Set Full Export to True

myCapabilities.FullExport = true;

If you have already created your ECMA MA, my advice is recreate it completely after you have made this change and compiled.

This will bring all the properties of the Object to the export collection Csentry. See this Technet article for more details.

Update the PutExportEntries code

In your code at the beginning iterate the AttributeChanges table to get the value of Attrib2,

foreach (CSEntryChange csentryChange in csentries)  

            {  

                if (csentryChange.ObjectType == “Person”)  

                {  

                    string myAttrib2 = null;  

                    foreach (var attributeChange in csentryChange.AttributeChanges)  

                    {  

                        if (attributeChange.Name == “Attrib2”)  

                        {                           

                            foreach (var changeVal in csentryChange.AttributeChanges[attributeChange.Name].ValueChanges)  

                            {  

                                myAttrib2 = changeVal.Value.ToString();  

                            }  

                        }                           

                      }  

Now iterate the ChangedAttributeNames collection. Notice I am using ObjectModificationType.Replace NOT
ObjectModificationType.Update

if (csentryChange.ObjectModificationType == ObjectModificationType.Replace)  

                    {  

                        foreach (string attribName in csentryChange.ChangedAttributeNames)  

                        {  

  

                            switch (attribName)  

                            {  

                                case “Email”:  

                                    foreach (ValueChange changeVal in csentryChange.AttributeChanges[“Email”].ValueChanges)  

                                    {