title: Active Directory COM Exception - An operations error occurred (0x80072020)
body: <p>I am getting an intermittent COM Exception "<strong>An operations error occurred (0x80072020)</strong>" (shown below) when I try and query Active Directory using the method <strong><a href="http://msdn.microsoft.com/en-us/library/bb344648.aspx" rel="noreferrer">GroupPrincipal.FindByIdentity</a></strong></p>
  
  <p>Here is my code:</p>
  
  <pre><code>PrincipalContext ctx = new PrincipalContext(ContextType.Domain, Environment.UserDomainName);
  GroupPrincipal groupPrincipal = GroupPrincipal.FindByIdentity(ctx, IdentityType.Name, "Group to find");
  </code></pre>
  
  <p>I am receiving Exception:</p>
  
  <pre><code>Inner Exception: System.Runtime.InteropServices.COMException (0x80072020): An operations error occurred.
    at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
    at System.DirectoryServices.DirectoryEntry.Bind()
    at System.DirectoryServices.DirectoryEntry.get_AdsObject()
    at System.DirectoryServices.PropertyValueCollection.PopulateList()
    at System.DirectoryServices.PropertyValueCollection..ctor(DirectoryEntry entry, String propertyName)
    at System.DirectoryServices.PropertyCollection.get_Item(String propertyName)
    at System.DirectoryServices.AccountManagement.PrincipalContext.DoLDAPDirectoryInitNoContainer()
    at System.DirectoryServices.AccountManagement.PrincipalContext.DoDomainInit()
    at System.DirectoryServices.AccountManagement.PrincipalContext.Initialize()
    at System.DirectoryServices.AccountManagement.PrincipalContext.get_QueryCtx()
    at System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithTypeHelper(PrincipalContext context, Type principalType, Nullable`1 identityType, String identityValue, DateTime refDate)
    at System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithType(PrincipalContext context, Type principalType, IdentityType identityType, String identityValue)
    at System.DirectoryServices.AccountManagement.GroupPrincipal.FindByIdentity(PrincipalContext context, IdentityType identityType, String identityValue)
  </code></pre>
  
  <p>The code is running from a <strong>Windows service</strong> on a <strong>Windows 2003 SP2 server</strong>.</p>
  
  <p>I have found another Stack Overflow question, <a href="https://stackoverflow.com/questions/5741479/active-directory-enumerating-users-gropus-com-exception/5798403#5798403">Active Directory, enumerating user&#39;s groups, COM exception</a>, suggesting that <strong>enabling Kerberos</strong> as an option in the PrincipalContext constructor will fix this problem but I am receiving a <em>different hex code</em> than in this question.</p>
  
  <p><strong>My questions are</strong>:</p>
  
  <ol>
  <li>Is this particular COM Exception definitely an authentication issue?  I need to be sure that this will 100% fix the problem before releasing the software.</li>
  <li>Is there a resource somewhere which lists all the possible COM exception hex codes so that I can help myself a bit better in the future?</li>
  </ol>