Forum Discussion
Jussi Palo
Feb 15, 2017Iron Contributor
Office PnP PowerShell: How to dispose SPWeb from Get-PnPSubWebs
Having foreach loop with Get-PnPSubWebs, how do I dispose SPWebs at the end of loop cycle?
Feb 15, 2017
I may not understand your question correctly. Dispose is available only through Context. You can post the sample to provide you the proper feedback.
- Jussi PaloFeb 15, 2017Iron Contributor
So like this?
foreach ($web in Get-PnPSubWebs) { #Do something with $web $web.Context.Dispose() # <<<<< }