I am using ASP.NET 2.0 with C#. I need to populate the uidNumber field from my provisioning app, and can't seem to find a good way of doing it.

I know that ADUC is capable of getting the next one off the stack, so to speak, but I don't know what it's calling to do that.

I have written code to search the entire directory and get the next uid based on what is already there, but don't want to have to do that because it's...