Thursday 31 January 2013

Get Status GUID

When dealing with workflows certain columns must be referenced via their GUID, this is a quick Powershell script to do just that

function LoadSharePointPowerShellEnviroment
{
write-host
write-host "Setting up Powershell enviroment for Sharepoint" -foregroundcolor Blue
Add-PSSnapin "Microsoft.Sharepoint.PowerShell" -ErrorAction SilentlyContinue
Write-host "Sharepoint PowerShell Snapin loaded." -foregroundcolor Green
}

write-host
LoadSharePointPowerShellEnviroment

$site = Get-SPSite ["http://YourUrl:80"]

$web = $site.rootweb
$pages = $web.lists["Item Approval Task"]
$statusField = $pages.Fields["Status"]

write-host $statusField.id