title: PermissiveModifyControl throws DirectoryOperationException in C# LDAP
body: <p>Using the <code>System.DirectoryServices.Protocols</code> namespace to add/modify attributes on an Active Directory group.  Code:</p>
  
  <pre><code>public void UpdateProperties(Dictionary&lt;string, string&gt; Properties) {
  
      List&lt;DirectoryAttributeModification&gt; directoryAttributeModifications;
  
      //  ... Code to convert Properties dictionary to directoryAttributeModifications
      //  There is one 'Add' modification, to set the 'description' of the group
  
      ModifyRequest modifyRequest = new ModifyRequest(groupDistinguishedName, directoryAttributeModifications.ToArray());
      modifyRequest.Controls.Add(new PermissiveModifyControl());
      ModifyResponse response = connection.SendRequest(modifyRequest) as ModifyResponse;
  </code></pre>
  
  <p>The <code>PermissiveModifyControl</code> is intended to keep the code from failing if the description already exists.  The only information on PermissiveModifyControl I've found is here:
  <a href="http://msdn.microsoft.com/en-us/library/bb332056.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/bb332056.aspx</a></p>
  
  <p>which states:</p>
  
  <blockquote>
    <p>An LDAP modify request will normally fail if it attempts to add an attribute that already exists or if it attempts to delete an attribute that does not exist.  With <code>PermissiveModifyControl</code> the modify operation succeeds without throwing a <code>DirectoryOperationException</code> error.</p>
  </blockquote>
  
  <p>However, when the above code gets to the <code>SendRequest()</code>, it throws a <code>DirectoryOperationException</code>:  "The attribute exists or the value has been assigned."</p>
  
  <p>What I'm trying to avoid is having to query every property in the collection being passed; if it exists, create a <code>Replace</code> <code>DirectoryAttributeModification</code>; if it doesn't, create an <code>Add</code> instead.  From what I can glean, <code>PermissiveModifyControl</code> is supposed to do just that.</p>
  
  <p>Can anyone shed some light on why <code>PermissiveModifyControl</code> still throws a <code>DirectoryOperationException</code>, and how to properly use it?</p>
  
  <p>Thanks in advance!
  James</p>