Re asking- C# DLL reading AD Active Directory RRS feed

  • Question

  • Hopefully this is the correct forum.

    I'm new to C#. I first created an EXE that uses AD .

    It works ok. I am now creating a DLL to do the same thing.

      sResults = dSearcher.FindAll();  //  <= this is where it bombs off

    catch(Exception ex)

     InputString = ex.Message.ToString() + ex.HResult.ToString() + Environment.NewLine; // I write this out to a file.

    I get error message  "An operations error occurred."

    HResult =  -2147016672

    I added a manifest to the DLL And I have    <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />

    Suggestions on what to try now?



    • Moved by Stanly Fan Tuesday, April 3, 2018 6:31 AM
    Monday, April 2, 2018 12:30 PM

All replies

  • Hello Steve,

    Consider asking here

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Monday, April 2, 2018 9:11 PM
  • Hi Steve4212,

    >>It works ok. I am now creating a DLL to do the same thingSuggestions

    Do you mean that you create reading AD Active Directory method in c# library project, then generate a DLL file and reference by another project (winforms, or others?), which encounter the issue?

    In addition, did you run the application as administrator? could you please share the steps, which can reproduce the issue, if possible, please share a simple sample via OneDrive. it will be beneficial to resolve the issue.

    Note: please remove privacy information before upload the sample to OneDrive.

    Best regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Tuesday, April 3, 2018 6:41 AM
  • I would suspect a permissions issue, but it would help to know what type of app the DLL is running under. You may find more info at the below link that can help:

    Paul ~~~~ Microsoft MVP (Visual Basic)

    Tuesday, April 3, 2018 12:15 PM