1

C# でhideすべてのプログラミングを使用する必要があります。default site templates from a custom user group except Blog and custom site templates

Level - 2 SharePoint Coordinator groupユーザーがカスタム サイト テンプレートからサイトを作成できるようにする必要があります。他のすべてのサイト テンプレートは非表示にする必要があります。

フル コントロールのアクセス許可レベルを持っLevel - 3 SharePoint Coordinator groupているので、このグループのユーザーはすべてのサイト テンプレートを利用できる必要があります。

私のコード:

 public override void FeatureActivated(SPFeatureReceiverProperties properties)
    {
        SPWeb web = properties.Feature.Parent as SPWeb;
        SPWebTemplateCollection templates = web.GetAvailableWebTemplates(1033, true);
        foreach (SPWebTemplate template in templates)
        {
            if (template.Name != "Blog" && template.DisplayCategory =="CUSTOM")
            {
                //how to attach the user group to a site template or any other suggestions
            }
        }
    }

私の質問は次のとおりです。 ユーザー グループをサイト テンプレートにアタッチする方法、またはカスタム サイト テンプレートをレベル 2 およびレベル 3 グループのすべてのサイト テンプレートに表示する方法は?

一部回答。

ありがとうシガーデイブ。ブログとカスタム サイト テンプレート以外の既定のサイト テンプレートを非表示にすることができました。以下はコードです。

        public override void FeatureActivated(SPFeatureReceiverProperties properties)
    {
        try
        {
            SPWeb web = properties.Feature.Parent as SPWeb;
            SPWebTemplateCollection templates = web.GetAvailableWebTemplates((uint)1033);
            Collection<SPWebTemplate> collection = new Collection<SPWebTemplate>();
            foreach (SPWebTemplate template in templates)
            {
                if(template.Name == "BLOG#0" || template.DisplayCategory == "Custom")
                collection.Add(template);
            }
            web.SetAvailableWebTemplates(collection, (uint)1033);
            web.Update();
        }
        catch (Exception ex)
        {
            System.Diagnostics.Debug.WriteLine(ex.ToString());
        }
    }

    public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
    {
        try
        {
            SPWeb web = properties.Feature.Parent as SPWeb;
            // Show all available web templates
            web.AllowAllWebTemplates();
            web.Update();
        }
        catch (Exception ex)
        {
            System.Diagnostics.Debug.WriteLine(ex.ToString());
        }
    }

このコードは、サイト コレクション管理者を含むすべてのユーザーのテンプレートを非表示にします。すべてのサイト テンプレートを有効にする方法、または SC 管理者に表示する方法は? ありがとう。

4

0 に答える 0