none
Attribute read only RRS feed

  • Question

  • I have a C# rules extension, and I am trying to update the homeDirectory attribute on an object in the MV, i keep getting an error that attribute is readonly, but I can successfully set if there the object hasnt been created yet. In other words I can not update the attribute or any attribute I put in the code below. I tried to reference http://social.technet.microsoft.com/Forums/en-US/ilm2/thread/a240c10c-019b-45c8-9835-32eab7f4dfc8, but I don't fully understand the resolution. Thx!

    if (1 == Connectors)
                {
                   
                    csentry = ManagementAgent.Connectors.ByIndex[0];
                    csentry.DN = DN;
                                 
                    //Applies to STUDENT Users
                    if(mventry["description"].Value.Equals("Student"))
                    {
                    mventry["homeDirectory"].Value = @"\\FIM\C$\HomeDirectories\" + mventry["cn"].Value;
                    }
                    csentry.CommitNewConnector();
                }

    produces System.InvalidOperationException: attribute homeDirectory is read-only
       at Microsoft.MetadirectoryServices.Impl.AttributeImpl.SetSingleValuedAttributeValue(Object value)

    Friday, June 1, 2012 7:14 PM

Answers

  • You can only initialize new objects or rename existing objects in provisioning.
    If you try to update any other attributes in your provisioining code, you get the read-only error.

    Yes, you will have to do this in an advanced attribute flow.
    Here is an example.
    Just search for MapAttributesForImport or MapAttributesForExport to get more examples.

    Cheers,
    Markus



    Markus Vilcinskas, Knowledge Engineer, Microsoft Corporation

    • Marked as answer by mario.exe Friday, June 1, 2012 9:45 PM
    Friday, June 1, 2012 9:44 PM

All replies

  • So is the only way to do this through an Advanced Import and/or Export Attribute Flow? Do you know of a reference for doing this in C#?
    • Edited by mario.exe Friday, June 1, 2012 7:42 PM
    Friday, June 1, 2012 7:26 PM
  • You can only initialize new objects or rename existing objects in provisioning.
    If you try to update any other attributes in your provisioining code, you get the read-only error.

    Yes, you will have to do this in an advanced attribute flow.
    Here is an example.
    Just search for MapAttributesForImport or MapAttributesForExport to get more examples.

    Cheers,
    Markus



    Markus Vilcinskas, Knowledge Engineer, Microsoft Corporation

    • Marked as answer by mario.exe Friday, June 1, 2012 9:45 PM
    Friday, June 1, 2012 9:44 PM
  • Modified the code in the example for my environment and it work 100% Thx Markus!

    Friday, June 1, 2012 9:46 PM