开发者

How to purge specific users/groups from a SharePoint site collection?

开发者 https://www.devze.com 2023-01-10 00:05 出处:网络
I am trying to write a utility to开发者_如何学Python find/delete specific users and groups from a SharePoint site collection. At this point I\'m using the SiteUsers property of the SPWeb class to do t

I am trying to write a utility to开发者_如何学Python find/delete specific users and groups from a SharePoint site collection. At this point I'm using the SiteUsers property of the SPWeb class to do the job, but I'm wondering: why isn't there a similar property in the SPSite class? This seems completely counter-intuitive to me (though at this point nothing about SharePoint surprises me anymore).

Is there a better way to do what I'm trying to do?

Related: SharePoint - Get a list of current users


Unfortunately, I can't really answer WHY it ended up that way... :) it is a fact of SharePoint that you have to call SPSite.OpenWeb() or SPSite.RootWeb and then use the SPWeb to get at SiteUsers. I think the way you are doing it using the object model is fine.

If you switch to use SharePoint's web services you could use these two methods: RemoveUserFromSite and RemoveGroup.

0

精彩评论

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