none
Global Classification/Site Policy and script editor webpart in 1000+ subsites RRS feed

  • Question

  • We are beginning to implement site classifications/site policies in our SharePoint 2013 environment.  Our site collection has 1000+ sub-sites and we'd like to see if there's a way to set a default site classification/site policy on all sites since we will be starting with site classification and greater security auditing.

    An example of what we'd like as an end result would be Scenario 3 here >> https://dev.office.com/patterns-and-practices-detail/1931

    Is there a PowerShell script to set all these sub-sites as a default classification/site policy of our choice?

    In addition to the default classification, we want to insert a script editor webpart on the top of each page that displays the site description.  Is there a way to insert this via PowerShell too?  Our code for this script editor webpart is:

    <script>
          _spBodyOnLoadFunctionNames.push("GetSiteInfo");
           var site;
           function GetSiteInfo()
           {
                var ctx = new SP.ClientContext.get_current();
                site = ctx.get_web();
                ctx.load(site);
                ctx.executeQueryAsync(onQuerySucceeded, onQueryFailed);
           }
           function onQueryFailed(sender, args) {
                alert('request failed ' + args.get_message() + '\n' +  args.get_stackTrace());
           }
           function onQuerySucceeded(sender, args) {
                var desc = document.getElementById('divSiteDescription')
                desc.innerHTML = site.get_description();
           }
    </script>
    <div id='divSiteDescription'></div>


    Monday, May 1, 2017 9:58 PM

All replies