开发者

How can I totally delete a user from Sharepoint 2010?

开发者 https://www.devze.com 2023-02-20 16:02 出处:网络
Ican delete a user from a site collection, but I can\'t seem to delete a user totally from SharePoint.

I can delete a user from a site collection, but I can't seem to delete a user totally from SharePoint.

For example:

Let's say DOMAIN\joetest has a user ID of 15. I can delete that account from the site collection (via web gui or powershell), but the next time that account is ensured the ID is开发者_如何学Go still 15.

Is there a way to totally delete a user from SharePoint? So, the next time the account is ensured it has a new ID (say 150 instead of 15).

Is that even possible.


You need to delete the User from each Web in SPSite.AllWebs loop through all Webs in SPSite.AllWebs and delete from SPWeb.AllUsers. Users in SPWeb.AllUsers include users in local created Groups in the Web and Site Collection Groups associated with it (Root level Groups). then remove the User from SPSite.SiteUsers.

If you are going to do this you might consider deleting the Users My Site, Profile and Alerts also as in My experience these will hang around otherwise. This cannnot be done via the Web GUI you will need to be administrator on the Local Machine and Site Collection / Farm Administrator in SharePoint and make yourself site colletion admin of the users My Site, and give correct permisions to your administrator account in Central Admin for manageing profiles.

You could can run this code from a console app. Also there are Powershell cmnds that can be used.


I'm not sure but have you also deleted the user from the Profile Service? Perhaps the user id is farm wide.


First off, why do you want to do this?

Secondly, if you go out to the all people view you might try deleting your person from there and if that works, there is a hidden special system list (that I can't recall the name of right now) that has the list of users. You could try and remove the person from that list.


Deleting the user would have been a temporary solution to a larger issue with code. Essentially could I find a temp fix so that my larger issue could be fixed in a proper manner.

The permanent solution to my issue was to recode a Timer Job. It didn't take long, and deleting the user became a non-issue.

in all I could not find a way to delete a user from the sharepoint user list. No matter how you delete the user from the site collection the user still remained in the user list.

0

精彩评论

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