471,122 Members | 1,579 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,122 software developers and data experts.

How to know when user has been created in the AD?

Hi, I'm building a C#-application that will simplify my daily work
(adding/removing/updating users in the AD). I'm using functions from
the System.DirectoryServices-namespace. When I have added a user I
want to set user-rights on a folder (which I create in my
application). The problem is that it takes a while until the user has
been added to the AD. If I just go on with setting the user-rights on
the folder I get an exception telling me there's no such user and
everything fails. I would like to know the best way to know when the
user has been added to the AD so I can go on with setting the user-
rights. Polling the AD seems like a bad idea (lots of overhead?).
Right now I'm using a 5 second delay between the user-creation and
setting the user-rights, I know that's a bad idea too, but at least
I'm not generating lots of queries to the AD.

Sep 19 '07 #1
1 1226
The overhead of polling the AD is probably fairly insignificant - when you
create a user in code you should be able to get a GUID back when the user is
created to determine whether your code can continue or not,

See the examples here:
http://www.codeproject.com/cs/system...ingInAD.asp#40

Regards

John Timney (MVP)
http://www.johntimney.com
http://www.johntimney.com/blog
"irrbloss" <ir******@gmail.comwrote in message
news:11**********************@k79g2000hse.googlegr oups.com...
Hi, I'm building a C#-application that will simplify my daily work
(adding/removing/updating users in the AD). I'm using functions from
the System.DirectoryServices-namespace. When I have added a user I
want to set user-rights on a folder (which I create in my
application). The problem is that it takes a while until the user has
been added to the AD. If I just go on with setting the user-rights on
the folder I get an exception telling me there's no such user and
everything fails. I would like to know the best way to know when the
user has been added to the AD so I can go on with setting the user-
rights. Polling the AD seems like a bad idea (lots of overhead?).
Right now I'm using a 5 second delay between the user-creation and
setting the user-rights, I know that's a bad idea too, but at least
I'm not generating lots of queries to the AD.

Sep 19 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Ian Davies | last post: by
161 posts views Thread by KraftDiner | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.