I want to use http://msdn.microsoft.com/en-us/library/aa370654%28VS.85%29.aspx in my code. But for some reason I cannot find what namespace to use for it. Three that I thought would work are
using System.DirectoryServices.AccountManagement;
using System.Runtime.InteropServices;
using System.DirectoryServices;
But none of these work. All of the examples of using NetUserGetInfo I can find are in C++, rather than C#. That makes me think that maybe I cannot use it in C#. Can I? And if so, what namespace I should use to have access to the NetUserGetInfo function? Any help is appreciated.
What namespace are you looking for? Namespaces are .NET specific notions. The
NetUserGetInfois a Win32 unmanaged function. If you want to invoke it from managed .NET code you need to write a managed wrapper and call it through P/Invoke.Here’s a useful site in this case which illustrates the following managed wrapper:
A user defined structure:
and a sample invocation: