views:

22

answers:

1

I'm trying to set the ForceCheckout property on an SPList item and it's just not taking. I'm calling the Update() command as required. All it should take, in essence, is the following two lines.

$myList.ForceCheckout = $false
$myList.Update()

Any ideas why this isn't working? It's remains $true no matter what.

+1  A: 

Are you really using $myList, or are you doing something like:

$web.lists["foo"].forcecheckout = $false
$web.lists["foo"].update()

...because the above won't work. Each time you use the Lists collection with an indexer like this, you're getting a new instance of the list. The second line doesn't know about the first line's changes. Ensure you do:

$myList = $web.Lists["foo"]
$myList.forcecheckout = $false
$myList.update()

This will work because you're using the same instance.

-Oisin

x0n
That's some impressive troubleshooting there Oisin! I'm not sure if you're correct yet, but I do indeed do it as you showed in the first code block. I'll switch it up and see what kind of result I get.
pk
You nailed it! I fixed it up. It also made me realize my disposal methods weren't working. I had been disposing of $SPWebColl[$i] and my memory usage was off the charts (because it wasn't working). Now I assign $SPWebColl[$i] to $currWeb and dispose of $currWeb at the end. My memory usage is now stable. Thanks!
pk