none
Getting invalid-attribute-value Error during Delta Import on Call-based ECMA2 RRS feed

  • Question

  • I'm developing an ECMA2 MA to which supports delta imports.  I have found very few samples of working code to do delta imports, so my attempts are created using a lot of trial and error... Any samples of working Call based MA's with delta support would be much appreciated :-)

    The data is located in a SQL server and the schema (for delta) is like this (simplified):

    EmpID string
    Status string
    UPDATESTATUS string (<-- This is the update column with values New/Update/Delete)

    For each EmpID, there may be multiple Status values, i.e. Status should be imported into a multi value attribute in FIM.

    For the full import this is working as expected, but I run into issues when attempting to do the delta imports

    The code for the delta import

    private GetImportEntriesResults GetImportEntries_Delta(GetImportEntriesRunStep importRunStep)

            {

                GetImportEntriesResults importReturnInfo;

                List<CSEntryChange> csentries = new List<CSEntryChange>();

                string employeeID = null;

                string appStatus = null;

                string currEmployeeID = "";

                CSEntryChange csentry = null;

                List<string> appStatusList = new List<string>();

                string changeMode = "";

                for (int i = currentReadRecord; i <= da.Tables["AppStatus"].Rows.Count - 1; i++)

                {

                    if (currEmployeeID != da.Tables["AppStatus"].Rows[i].ItemArray.GetValue(0).ToString().Trim())

                    {

                        if (currEmployeeID != "") // this should be true except for the first run

                        {

                            csentry.AttributeChanges.Add(AttributeChange.CreateAttributeUpdate("IdentityStores", appStatusList));

                            csentries.Add(csentry);

                            appStatusList = new List<string>();

                            if (csentries.Count >= m_importPageSize)

                            {

                                currentReadRecord = i;

                                importReturnInfo = new GetImportEntriesResults();

                                importReturnInfo.MoreToImport = (i <= da.Tables["AppStatus"].Rows.Count - 1);

                                importReturnInfo.CSEntries = csentries;

                                return importReturnInfo;

                            }

                        }

                        changeMode = da.Tables["AppStatus"].Rows[i].ItemArray.GetValue(2).ToString().Trim();

                        csentry = CSEntryChange.Create();

                        csentry.ObjectType = "ApplicationIdentity";

                        employeeID = da.Tables["AppStatus"].Rows[i].ItemArray.GetValue(0).ToString().Trim();

                        currEmployeeID = (string)employeeID;

                        switch (changeMode)

                        {

                            case "New":

                                csentry.ObjectModificationType = ObjectModificationType.Add;

                                csentry.AttributeChanges.Add(AttributeChange.CreateAttributeAdd("EmployeeID", employeeID));

                                break;

                            case "Update":

                                csentry.ObjectModificationType = ObjectModificationType.Update;

                                csentry.DN = employeeID;

                                break;

                            case "Delete":

                                csentry.ObjectModificationType = ObjectModificationType.Delete;

                                csentry.DN = employeeID;

                                break;

                            default:

                                throw new UnexpectedDataException(string.Format("Unknown modification type: {0}", changeMode));

                        }

                    }

                    appStatus = da.Tables["AppStatus"].Rows[i].ItemArray.GetValue(1).ToString().Trim();

                    appStatusList.Add(appStatus);

                }

                // save the last object

                if (csentry != null)

                {

                    csentry.AttributeChanges.Add(AttributeChange.CreateAttributeUpdate("IdentityStores", appStatusList));

                    csentries.Add(csentry);

                }

                importReturnInfo = new GetImportEntriesResults();

                importReturnInfo.MoreToImport = false;

                importReturnInfo.CSEntries = csentries;

                return importReturnInfo;

            }

    The code compiles and executes, but the delta import fails with the "invalid-attribute-value" message per csentry.

    From the eventlog I have the following message

    The server encountered an unexpected error while performing an operation for a management agent.

    "System.InvalidCastException: Unable to cast object of type 'System.Collections.Generic.List`1[System.String]' to type 'System.String'.

       at Microsoft.MetadirectoryServices.Impl.Ecma2ConversionServices.AddAttributeToDImage(CDImage* pdimage, String attributeName, AttributeModificationType attributeModificationType, IList`1 attributeValueChanges, Int32 escapeReferenceDNValues)

       at Microsoft.MetadirectoryServices.Impl.Ecma2ConversionServices.ConvertToDImage(CSEntryChange csEntryChange, CDImage** ppDImage, Int32 escapeReferenceDNValues)

       at Microsoft.MetadirectoryServices.Impl.ScriptHost.InvokeExtMA_ImportEntry(UInt32 cBatchSize, UInt16* pcszCustomData, UInt32 cFullObject, _OCTET* rgoctFullObject, UInt32* rgomodt, UInt32* pcpcszChangedAttributes, UInt16*** prgpcszChangedAttributes, Int32 fIsDNStyleNone, UInt16** ppszUpdatedCustomData, _OCTET* rgoctCSImage, Int32* rgextec, UInt16** rgpszErrorName, UInt16** rgpszErrorDetail, Int32* pfMoreToImport)"

    To me it seems as if FIM is unable to process the List of strings that is returned when processing the delta. Remember that this works OK when doing the full import. 

    Do you have any suggestions as to why this fails?

    Kjetil

    Tuesday, April 14, 2015 9:33 AM

All replies

  • I ran into the same problem when developing an ECMA2 MA.  I found that I had to use a List<object> instead of List<string> with the AttributeChange.CreateAttributeUpdate function.
    Friday, June 26, 2015 1:33 PM
  • What BradEC says could be the problem.

    You should also check the type of the attribute "IdentityStores" in your GetSchema() method. It should be multivalue.


    Did my post help? Please use "Vote As Helpful", "Mark as answer" or "Propose as answer". Thank you!


    Friday, June 26, 2015 1:47 PM