views:

21

answers:

1

Hello

I've been asked to create a solution which detects the dead accounts and cleans it up from a SharePoint site.

I found a code snippet here (in the comments) which checks each user against the AD and cleans up the account. But the LDAP details are hardcoded in the code. What happens if i want to detect it dynamically and check the dead accounts? Is there a more elegant solution to do this?

Any ideas?

A: 

I looked at the code and it does NOT use LDAP at all. There are no authentication details anywhere in the code. All the code assumes is that an Administrator is running it from the server. It itterates the site collection users and removes them all.

This doesn't check for dead accounts. For that you'd have to check the value of web.SiteUsers[offsetIndex].ID against your LDAP database for suspended and/or deleted users and then ONLY remove those users.

Cornelius J. van Dyk
I've asked to check the code in the comments section in that link and not the one in the article.
NLV