locked
How does the CSEntryChangeResult work? RRS feed

  • Question

  • I'm trying to find out how to use the CSEntryChangeResult in ECMA2, to report export errors in PutExportEntries

    My code goes like this:


    Dim _returnValues as PutExportEntriesResults

    for Each _csEntry as CSEntryChange In csentries
      Select Case _csEntry.ObjectModificationType
        Case ObjectModificationType.Add
          Dim _myExportError as MAExportError = OwnFunctionWriteToSystem(_csEntry)
          _csEntry.ErrorCodeExport = _myExportError
          Dim _EntryResult As CSEntryChangeResult = CSEntryChangeResult.Create(_csEntry.Identifier, _csEntry.AttributeChanges, _myExportError)
          _returnValues.CSEntryChangeResults.Add(_EntryResult)
        case else
          Throw New EntryPointNotImplementedException()
      End Select
    Next    

    return _returnValues

    But, even for an MAExportError.success, this throws the following in the eventlog:

    The management agent controller encountered an unexpected error.

     "BAIL: MMS(3644): d:\bt\9394412\private\source\miis\ma\extensible\extensionmanager.cpp(550): 0x80230709 (unable to get error text)
    BAIL: MMS(3644): d:\bt\9394412\private\source\miis\ma\extensible\extensionmanager.cpp(2400): 0x80230709 (unable to get error text)
    BAIL: MMS(3644): d:\bt\9394412\private\source\miis\ma\extensible\export.cpp(2004): 0x80230709 (unable to get error text)
    BAIL: MMS(3644): d:\bt\9394412\private\source\miis\ma\extensible\export.cpp(462): 0x80230709 (unable to get error text)
    BAIL: MMS(3644): d:\bt\9394412\private\source\miis\cntrler\cntrler.cpp(9624): 0x80230709 (unable to get error text)
    BAIL: MMS(3644): d:\bt\9394412\private\source\miis\cntrler\cntrler.cpp(8376): 0x80230709 (unable to get error text)
    Forefront Identity Manager 4.1.2273.0"

    I looks like that I have to define some error text somewhere. But neither the csentry object or the MAexportError object support this (as far as I can see)

     Anyone tried working with this?

    Thanks, Søren.

    Sunday, September 9, 2012 9:20 AM

Answers

  • Hi Søren,

    Have you tried stepping through the code at runtime to see if it is a specific record causing the issue or if it affects all records? I have a similar method implemented without any issues. We did not need to create a csentrychangeresult unless we were changing a value like the guid in the export process, but merely set the result to the csentrychange object.

    Here is a sample set(in c#) of how we implemented our MA.

      public PutExportEntriesResults PutExportEntries(IList<CSEntryChange> csentries)
            {
                PutExportEntriesResults exportEntriesResults = new PutExportEntriesResults();
    
    
                foreach (CSEntryChange csentryChange in csentries)
                {
                    List<AttributeChange> attributeChanges = new List<AttributeChange>();
                    csentryChange.ErrorCodeExport = MAExportError.Success; //Default State
                    if (csentryChange.ObjectType == "User")
                    {
                        try
                        {
                            switch (csentryChange.ObjectModificationType)
                            {
                                case ObjectModificationType.Add:
    
                                    //User Creation Code
                                    createUser(csentryChange);
                                    attributeChanges.Add(AttributeChange.CreateAttributeUpdate("Guid", newGuid));//Guid was changed to reflect the actual one in the source system.
                                    exportEntriesResults.CSEntryChangeResults.Add(CSEntryChangeResult.Create(csentryChange.Identifier, attributeChanges, MAExportError.Success));
                                    break;
                                case ObjectModificationType.Delete:
    
                                    //User Deletion Code
    
    
                                    break;
                                case ObjectModificationType.Update:
    
                                case ObjectModificationType.Replace:
                                    //User Update Code in our case does both the update and replace functions in the process
                                    break;
    
                                default:
                                    break;
                            }
    
                        }
                        catch (Exception)
                        {
                            csentryChange.ErrorCodeExport = MAExportError.ExportErrorConnectedDirectoryError;//if any error occur it will throw a connected directory export error
    
                        }
                    }
                    exportEntriesResults.CSEntryChangeResults.Add(CSEntryChangeResult.Create(csentryChange.Identifier, attributeChanges, MAExportError.Success));
                }
    
              
                return exportEntriesResults;
            }
    
            private void createUser(CSEntryChange csentryChange)
            {
                // Data Consistency checking for required Attributes
                if (csentryChange.AttributeChanges["DisplayName"].ValueChanges[0].Value == null)
                {
                    csentryChange.ErrorCodeExport = MAExportError.ExportErrorMissingAnchorComponent;
                    throw new Exception("The CSEntry Attribute Value for DisplayName does not exist, please ensure that the value is present in the connector space");
                }
                if (csentryChange.AttributeChanges["uid"].ValueChanges[0].Value == null)
                {
                    csentryChange.ErrorCodeExport = MAExportError.ExportErrorMissingAnchorComponent;
                    throw new Exception("The CSEntry Attribute Value for UsageLocation does not exist, please ensure that the value is present in the connector space");
                }
    
                // Code to create the object with additional error code checking
                        
            }


    Visit My Blog: http://theidentityguy.blogspot.com/

    Thursday, September 27, 2012 1:56 AM

All replies

  • Hi Søren,

    Have you tried stepping through the code at runtime to see if it is a specific record causing the issue or if it affects all records? I have a similar method implemented without any issues. We did not need to create a csentrychangeresult unless we were changing a value like the guid in the export process, but merely set the result to the csentrychange object.

    Here is a sample set(in c#) of how we implemented our MA.

      public PutExportEntriesResults PutExportEntries(IList<CSEntryChange> csentries)
            {
                PutExportEntriesResults exportEntriesResults = new PutExportEntriesResults();
    
    
                foreach (CSEntryChange csentryChange in csentries)
                {
                    List<AttributeChange> attributeChanges = new List<AttributeChange>();
                    csentryChange.ErrorCodeExport = MAExportError.Success; //Default State
                    if (csentryChange.ObjectType == "User")
                    {
                        try
                        {
                            switch (csentryChange.ObjectModificationType)
                            {
                                case ObjectModificationType.Add:
    
                                    //User Creation Code
                                    createUser(csentryChange);
                                    attributeChanges.Add(AttributeChange.CreateAttributeUpdate("Guid", newGuid));//Guid was changed to reflect the actual one in the source system.
                                    exportEntriesResults.CSEntryChangeResults.Add(CSEntryChangeResult.Create(csentryChange.Identifier, attributeChanges, MAExportError.Success));
                                    break;
                                case ObjectModificationType.Delete:
    
                                    //User Deletion Code
    
    
                                    break;
                                case ObjectModificationType.Update:
    
                                case ObjectModificationType.Replace:
                                    //User Update Code in our case does both the update and replace functions in the process
                                    break;
    
                                default:
                                    break;
                            }
    
                        }
                        catch (Exception)
                        {
                            csentryChange.ErrorCodeExport = MAExportError.ExportErrorConnectedDirectoryError;//if any error occur it will throw a connected directory export error
    
                        }
                    }
                    exportEntriesResults.CSEntryChangeResults.Add(CSEntryChangeResult.Create(csentryChange.Identifier, attributeChanges, MAExportError.Success));
                }
    
              
                return exportEntriesResults;
            }
    
            private void createUser(CSEntryChange csentryChange)
            {
                // Data Consistency checking for required Attributes
                if (csentryChange.AttributeChanges["DisplayName"].ValueChanges[0].Value == null)
                {
                    csentryChange.ErrorCodeExport = MAExportError.ExportErrorMissingAnchorComponent;
                    throw new Exception("The CSEntry Attribute Value for DisplayName does not exist, please ensure that the value is present in the connector space");
                }
                if (csentryChange.AttributeChanges["uid"].ValueChanges[0].Value == null)
                {
                    csentryChange.ErrorCodeExport = MAExportError.ExportErrorMissingAnchorComponent;
                    throw new Exception("The CSEntry Attribute Value for UsageLocation does not exist, please ensure that the value is present in the connector space");
                }
    
                // Code to create the object with additional error code checking
                        
            }


    Visit My Blog: http://theidentityguy.blogspot.com/

    Thursday, September 27, 2012 1:56 AM
  • Thanks!

    Not sure what the problem was. But when I knew I was going down the right path I got it to work.

    /Søren

    Thursday, September 27, 2012 6:39 PM