Wednesday, August 17, 2011

Powershell script to list the integer value of each member of an Enumeration

I couldn't easily find something that did this, so here is what I came up with.


[Reflection.Assembly]::LoadFile("C:\temp\Microsoft.SharePoint.dll")

foreach ($value in [Microsoft.SharePoint.SPFieldType]::GetValues
([Microsoft.SharePoint.SPFieldType]))
{
$int = [Convert]::ToInt32($value)
Write-Host $value = $int
}

No comments:

Post a Comment