Detected use of SPRequest for previously closed SPWeb objec

Mar 14, 2012 at 1:48 PM


I tried to use your script with two document libraries. One documentlibrary has a eventreceiver ItemAdded (for additional document metadata setting) and the other one has no event receiver. 

Uploading 2000 documents into the doclib without any eventreceivers works fine. The other one trows an error after 1-5 documents and the script stopps.

Detected use of SPRequest for previously closed SPWeb object.  Please close SPWeb objects when you are done with all objects obtained from them, but not before.  Stack trace:    at Microsoft.SharePoint.SPListCollection.GetListByName(String strListName, Boolean bThrowException)     at get_Item(Object , Object[] )     at System.Management.Automation.DotNetAdapter.AuxiliaryMethodInvoke(Object target, Object[] arguments, MethodInformation methodInformation, Object[] originalArguments)     at System.Management.Automation.ParserOps.CallMethod(Token token, Object target, String methodName, Object[] paramArray, Boolean callStatic, Object valueToSet)     at System.Management.Automation.ArrayReferenceNode.GetItem(Object target, Object index)     at System.Management.Automation.ArrayReferenceNode.Get...

Does anyone have a clue why this might happen?