none
Attribute is Not present RRS feed

  • Question

  • Hello All,

    There is a need to update the status of the record in MV when there change in value for location in SQL table, The code is working for the existing user, it fails for the New user with the Error message. Kindly advice.

    Microsoft.MetadirectoryServices.AttributeNotPresentException: Attribute "location" is not present.
       at Microsoft.MetadirectoryServices.Impl.AttributeImpl.get_Value()
       at Mms_ManagementAgent_SQLMAExtension1.MAExtensionObject.Microsoft.MetadirectoryServices.IMASynchronization.MapAttributesForImport(String FlowRuleName, CSEntry csentry, MVEntry mventry)

    The below is scenario

     NEW - Update mventry["status"].value = "NEW"
     Update - Update mventry["status"].value = "Update"
     No Update - Update mventry["status"].value = "No update receive"


    Advance attribute flow is mapped location(Datasource)->location(MV)

    The Code is below

    case "Status":    

     

     if ( string.IsNullOrEmpty(mventry["location"].Value)== true)
               {   
                        // New creation

                        mventry["status"].Value = "NEW";

               }
                    else
                           {
                                    
                              if (csentry["location"].Value == mventry["location"].Value)
                                      {
                                             // NO Update

                                              mventry["status"].Value = "No update receive";

                                        }
                                             else
                                                   {
                                                     //Update

                                                       mventry["status"].Value = "Update";                               

                                                        }
                               
                            }

                            break;

    Thanks and Regards,
    Anirban Singha

    Sunday, November 2, 2014 11:37 AM

Answers

  • Hi,

    this error comes from the first part of the code.

    you should check if location IsPresent first before checking of values (even like Null or Empty).
    If this is a new User i think location will be NotPresent, so the condition will fail.

    Do this always when checking for attribute in code.

    Regards
    Peter


    Peter Stapf - ExpertCircle GmbH - My blog: JustIDM.wordpress.com

    • Marked as answer by AnirbanSingha Sunday, November 2, 2014 8:03 PM
    Sunday, November 2, 2014 6:05 PM

All replies

  • Hi Anirban,

    Please check if the Attribute "location" is populated for new users once it is provisioned to mv. As per your code  "status" is  updated only if Attribute "location" has values, so check for new users if "location" is populated with value. (Try this for new users Delta Import of source MA , then do a preview for that user [full sync & commit preview] and check for the value).

    Thanks,

    Prathibha K.

    Sunday, November 2, 2014 2:22 PM
  • Hi,

    this error comes from the first part of the code.

    you should check if location IsPresent first before checking of values (even like Null or Empty).
    If this is a new User i think location will be NotPresent, so the condition will fail.

    Do this always when checking for attribute in code.

    Regards
    Peter


    Peter Stapf - ExpertCircle GmbH - My blog: JustIDM.wordpress.com

    • Marked as answer by AnirbanSingha Sunday, November 2, 2014 8:03 PM
    Sunday, November 2, 2014 6:05 PM
  • Thanks Peter, Its works like a magic.. I had spent my weekend to get this fix.

    Frankly I was behind this for last two days, Code is a New field for me.. lots of learning have to be done in this regards.

    Best Regards,
    Anirban Singha

    Sunday, November 2, 2014 8:06 PM