In a Sharepoint 2010 Enterprise site. I've got a library containing documents pertaining to foreign countries. So I have folders for Argentina, Chile, etc.. The list items have a text field called Country which I'm trying to set.
I don't want to go through all the folders and set the default Country field to the same as the containing folder, so I'm writing a Powershell script...
$lib = $web.Lists["dguide"] $metadataDefaults = New-Object -TypeName Microsoft.Office.DocumentManagement.MetadataDefaults -ArgumentList $lib $Thisfolder = $web.GetFolder("dguide/$Foldername") $metadataDefaults.SetFieldDefault($Thisfolder,"Country", $Foldername) $metadataDefaults.update() $Thisfolder.update() $lib.update() $folderDefaultValue = $metadataDefaults.GetFieldDefault($Thisfolder, "Country") "the value is now $folderDefaultValue"
Even though the value appears to change, it doesn't change in practice. The folder gets a little green 'settings' gear suggesting customization, but the value is "" for country.
So what am I doing wrong?