Setting ForceCheckout to SPList

I'm trying to set the ForceCheckout property on an SPList element and it just doesn't accept. I call the Update () command as needed. All of this should occupy essentially the next two lines.

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

      

Any ideas why this isn't working? This remains true no matter what.

+2


a source to share


1 answer


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

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

      

... because the above won't work. Each time you use a collection of lists with this index, you get a new instance of the list. The second line is unaware of the first line changes. Make sure you do:



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

      

This will work because you are using the same instance.

-Oisin

+4


a source







All Articles