ECMA 2.2 - CSentry["Attribute"].Value RRS feed

  • Question

  • Hi

    quick question!
    Whats the Ecma2.2 equivalent of csentry["Attributename"].Value?

    Trying to convert an XMA Managmnet Agent to ECMA 2.2 put having trouble reading attributes that's not in the Attributechanges.

    Need to generate an URL with the employee ID field and the email field ,email field (changed)

    emploeeID is not the anchor so i don't think i can use anchorattribute.

    in XMA i just did this:

    URL = exporturl + "/user/" + csentry["emploeeID"].Value + "/email/" + csentry["Mail"].Value;

    in ECMA2 i can't seem to access the employeeid field:

    URL = exporturl + ??????? + "/email/" + csentry.AttributeChanges["email"].ValueChanges[0].Value.ToString();

    Monday, November 16, 2015 1:12 PM

All replies

  • The values you get depend on your settings / config parameters for your MA. If you have set it to ObjectReplace, you'll get all values in AttributeChange on the CSEntryChanges in the PutExportEntries and can pick them up from there.

    Regards, Soren Granfeldt
    blog is at | facebook | twitter at!/MrGranfeldt

    Monday, November 16, 2015 2:52 PM
  • Thanks for your reply.

    I found other post refering to the export method "Object Replace". Changed the exporttype, but im not seeing any changes. Still get that the "The given key was not present in the dictionary" when i try to access the employeeID field.

    Snippits from the code:

    //Export type set to ObjectReplace myCapabilities.ExportType = MAExportType.ObjectReplace; //Schema Person(Tried setting it to ImportExport to see if it made a difference.) person.Attributes.Add(SchemaAttribute.CreateSingleValuedAttribute("employeeId", AttributeType.String, AttributeOperation.Import)); ________________________________________________

    public PutExportEntriesResults PutExportEntries(IList<CSEntryChange> csentries) { foreach (CSEntryChange csentry in csentries) { //DebuglogTEst Log.WriteLine(string.Format("Export detected for user ID, {0} of type {1}", csentry.DN, csentry.ObjectModificationType)); try { Log.WriteLine("employeeID: " + csentry.AttributeChanges["employeeId"].ValueChanges[0].ToString()); //Line 604 } catch (Exception ex) { Log.WriteLine(ex.Message); Log.WriteLine(ex.StackTrace); }

    Stack trace:

    The given key was not present in the dictionary.
       at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
       at System.Collections.ObjectModel.KeyedCollection`2.get_Item(TKey key)
       at FimSync_Ezma.EzmaExtension.PutExportEntries(IList`1 csentries) in c:\...........:line 604

    Line 604 is the Log.Writeline in the try catch statement.

    • Edited by T Larsen Tuesday, November 17, 2015 8:16 AM
    Tuesday, November 17, 2015 8:15 AM
  • Make sure that you are spot on with the casing for the attribute names. The ECMA framework is very particular about this. Also, if the value is missing from an attribute, you do not have any ValueChanges object with ObjectReplace, but can assume that the value for that attribute is <null> or empty, so you need to handle this. If you are using AttributeReplace, you'll get information about what to do with a value, such as Add, Modify or Delete.

    Regards, Soren Granfeldt
    blog is at | facebook | twitter at!/MrGranfeldt

    Tuesday, November 17, 2015 8:24 AM