如何从 SharePoint 网站集中清除特定用户/组?

发布于 2024-09-13 08:09:13 字数 365 浏览 4 评论 0原文

我正在尝试编写一个实用程序来从 SharePoint 网站集中查找/删除特定用户和组。此时,我正在使用 SPWeb 类的 SiteUsers 属性来完成这项工作,但我想知道:为什么 SPWeb 类中没有类似的属性代码>SPSite类?这对我来说似乎完全违反直觉(尽管此时 SharePoint 已经不再让我感到惊讶了)。

有更好的方法来做我想做的事情吗?

有关的: SharePoint - 获取当前用户列表

I am trying to write a utility to 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

抱着落日 2024-09-20 08:09:13

不幸的是,我无法真正回答为什么会这样......:) SharePoint 的事实是您必须调用 SPSite.OpenWeb() 或SPSite.RootWeb,然后使用 SPWeb 获取 SiteUsers。我认为您使用对象模型的方式很好。

如果您改用 SharePoint 的 Web 服务,可以使用以下两种方法: 从站点中删除用户删除组。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文