停用 MySite 上的网站集功能

发布于 2024-08-16 04:17:16 字数 350 浏览 4 评论 0原文

我们有一个自定义母版页,根据这些说明部署到 MySite Web 应用程序 - http://www.sharepointblog.com/ 2008/07/sp2007-custom-master-pages-on-subsites.html

但是,我们需要能够在 MySite Web 应用程序内的所有网站集上停用该功能。该功能构建为网站集范围。我们如何在可能拥有 3000 多个 MySites 的应用程序上停用它们?

We have a custom master page that is deployed to the MySite web application per these instructions -
http://www.sharepointblog.com/2008/07/sp2007-custom-master-pages-on-subsites.html

However, we require the ability to deactivate the feature on all the site collections that are within the MySite webapplication. The feature is built as a site collection scope. How would we deactivate them on an application that has potentially 3000+ MySites?

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

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

发布评论

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

评论(2

平生欢 2024-08-23 04:17:16

我将构建一个简单的控制台应用程序,它会迭代 Web 应用程序的所有网站集 (MySites) 并停用该功能。您必须以提升权限运行这段代码 (SPSecurity.RunWithElevatedPrivileges),以便您有权停用网站集功能。

private static void DeleteWebsiteCollections()
        {
            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                SPWebApplication webApp = SPWebApplication.Lookup(new Uri("http://MySiteHostWebApp"));
                SPSiteCollection mySites = webApp.Sites;

                foreach (SPSite site in mySites)
                {
                    site.Features.Remove(new Guid("place your feature id here"));

                    if (null != site)
                    {
                        site.Dispose();
                    }
                }
            });
        }

I would build a simple console application which iterates over all site collections (MySites) of your web application and deactivates the feature. You'll have to run this piece of code with elevate privileges (SPSecurity.RunWithElevatedPrivileges) so you have the permission to deactivate a site collection feature.

private static void DeleteWebsiteCollections()
        {
            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                SPWebApplication webApp = SPWebApplication.Lookup(new Uri("http://MySiteHostWebApp"));
                SPSiteCollection mySites = webApp.Sites;

                foreach (SPSite site in mySites)
                {
                    site.Features.Remove(new Guid("place your feature id here"));

                    if (null != site)
                    {
                        site.Dispose();
                    }
                }
            });
        }
风渺 2024-08-23 04:17:16

该代码也可以钉入母版页中。
仅 site.Features.Remove(new Guid("将您的功能 id 放在这里"));应该保留。

This code can be stapled into the masterpage too.
Only site.Features.Remove(new Guid("place your feature id here")); should remain.

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