Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagepowershell
#Name: Set-SiteClassification
#Description: Applies details of the site classification to the property bag on the root web.  
#           : ComindedCombinded with the classify.js script, the classification will display at the top center of the web page. 
#Note:This is informational only and requires a reference to the classify.js script.
#Usage: 
#    $green = "#18A329"
#    $white = "#ffffff"
#    .\ClassifySiteCollection "http://mysharepoint" "Low" $green $white "http://mysharepoint/pages/classificatons.aspx"
param
(
    $siteCollectionUrl = (Read-Host "Please enter a site collection URL"),
    $name = (Read-Host "Please enter a classificaton name"),
    $backColor = (Read-Host "Please enter the background color value"),
    $color = (Read-Host "Please enter the foreground color"),
    $url = (Read-Host "Please enter the url of the classificaton definition")
)
$site = get-spsite $siteCollectionUrl
$web = $site.RootWeb;
$web.AllProperties['ClassificationColor'] = $color
$web.AllProperties['ClassificationBackColor'] = $backColor
$web.AllProperties['ClassificationName'] = $name
$web.AllProperties["ClassificationUrl"] = $url
$web.Update()
"A classification of '$name' has been applied to site collection " + $site.Url 

...