Hi All,
I need help to read default value of managed metadata field of a document library using powershell. I am able to set default value in powershell and can view default value in doc library settings but I get null value when I try to read default value using powershell.
echo $spList["Record Classification"].DefaultValue
even tried
$field = $spList.Fields.GetField("Record Classification") -as [Microsoft.SharePoint.Taxonomy.TaxonomyField]
echo $field.DefaultValue
I am using the following code to set default value of this field.
$term = GetTerm -siteColl $spWeb.Site
if ($term)
{
$cDef = New-Object Microsoft.Office.DocumentManagement.MetadataDefaults($spList)
$cDef.SetFieldDefault($spList.RootFolder, $spList.Fields["Record Classification"].InternalName,$spWeb.Language.ToString() + ";#" + $term.Name + "|" + $term.Id)
$cDef.Update();
write-host $term.Name " set as Record Classification column's default value in " $spList.Title " document library" -foregroundcolor DarkCyan
}Any ideas?
Amar