开发者

Detecting dead accounts and cleaning them from a SharePoint site

开发者 https://www.devze.com 2023-01-19 11:21 出处:网络
I\'ve been asked to create a solution which detects the dead accounts and cleans it up from a SharePoint site.

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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号