Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

PowerShell to Update Library Metadata - Update all items without column filled out

$
0
0

Hello,

I am trying to update one column for all relevant documents in a library. In this library, we have a column called "Picture Type", and I need to fill out all photos that have nothing selected in that column. I want them to all change to "7– Miscellaneous."  The script I am using below worked when I was updating the column from one value to another. However, it seems I am not able to select all (blank) entries and fill them out.

#Get the specific Web site where the list is housed and set a vairable $web
$web =Get-SPWeb http://siteURL/#Get the specific list you want to update
$list = $web.Lists["Test"]#Find items in the current list
$listItems = $list.Items#Go through list and update Photo Type with numbersforeach($item in $listItems){if($item["Photo Type"]-eq " "){
        $item["Photo Type"]="7 - Miscellaneous"
        $item.Update()}}#dispose of web
$web.dispose();
I appreciate your help! Thanks.

Viewing all articles
Browse latest Browse all 7589

Trending Articles



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