Quantcast
Channel: SharePoint 2010 - General Discussions and Questions forum
Viewing all articles
Browse latest Browse all 17574

PowerShell can update List Fields but not Document Library Fields

$
0
0

Hi all,

I am experiencing odd behavior where I can update a List's fields but not a Library's. Ex. I have a Department Managed Metadata field in a Document Library, and a Department Managed Metadata field in a List. Using the following, I can null (clear) the values in the Department field in the list, but it doesn't work in a library. Other scripts are giving me the same issue.

$web = Get-SPWeb http://intranet.yourcompany.com/operations/
$list = $web.lists["Test List"]
$items = $list.getItems()
$lf = $list.Fields["Department"]
foreach($i in $items)
{
if([String]::IsNullOrEmpty($i["Department"]) -ne $true)
{
$lf.ParseAndSetValue($i,$null);
$i.Update();
}
}
Please help.

Personal Blog: http://thebitsthatbyte.com


Viewing all articles
Browse latest Browse all 17574

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>