I recently upgraded from Sharepoint 2007 to 2010. I have a windows service that inserts pdfs into sharepoint. It works great on 2007. When I migrated to 2010, I started getting the following intermittent error:
<nativehr>0x80070002</nativehr>
at Microsoft.SharePoint.Library.SPRequestInternalClass.GetMetadataForUrl(String bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType, Object& pvarFileOrFolder) at
Microsoft.SharePoint.Library.SPRequest.GetMetadataForUrl(String bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType, Object& pvarFileOrFolder) at Microsoft.SharePoint.SPWeb.GetList(String strUrl)
Here is the offending line of code:
SPList parentList = web.GetList(url);
What's weird, is that this only occasionally fails. I've actually wrapped this line of a loop, and if it it fails, I wait a bit, and then try to get the list again. Usually after a few tries, the GetList will succeed.
Since it's not easly duplicatable, I'm looking for any leads I might be able to track down.
From google searches, the "recommend" fix is to change any .GetList(...) calls to SPWeb.Lists[".."];
But, I got away from that, due to the perf hit on 2007 ( .GetList(...) has better perf than SPWeb.Lists["..."])
Any suggestions?
Thanks!
Dave