Friday 24 August 2012

Powershell script - adds custom site column to content type (MOSS)


Used this script today to add a custom site column (Forarchive) to the core Content Type - Document

********************************************


[void][System.Reflection.Assembly]::Load("Microsoft.Office.Server.Search, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c")

[void][System.Reflection.Assembly]::Load("Microsoft.Sharepoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c")

[void][System.Reflection.Assembly]::Load("Microsoft.Office.Server, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c")

********************************************

$url = "http:///sites/sitename/"
$site = new-object Microsoft.SharePoint.SPSite($URL)

$web = $site.RootWeb

$ct=$web.ContentTypes["Document"];
$fieldAdd=$web.Fields["ForArchive"]
$fieldLink=New-Object Microsoft.SharePoint.SPFieldLink($fieldAdd)
$ct.FieldLinks.Add($fieldLink);
$ct.Update()

$web.Dispose()
$site.Dispose()


SharePoint Information Architecture Diagram

Here is the template I use for Information Architecture designs. It's built using Mindjet and I flesh the nodes out with the low level d...