<nativehr>0x80070002</nativehr> in Sharepoint 2010

5

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

sharepoint-2010
asked on Stack Overflow Apr 21, 2011 by dave wanta

3 Answers

0

Maybe you could understand the error better if you first retrieved an SPFolder or SPFile related to the url in question. Check .GetFile(...).Exists and .GetFolder(...).Exists. You could also get the ParentList property hence.

answered on Stack Overflow Sep 29, 2011 by Alexey
0

SPWeb.GetList Method will certainly raise error if list is not there in the site. The method is designed like that. It is already documented in msdn.

If you are unsure that list is there or not; use Webobject.List[ListName] to avoid exception.

You can check my blog SharePoint Codes for sample code

I think this is late reply, but hope it helps others in future.

answered on Stack Overflow Mar 26, 2012 by AdiCodes • edited Mar 26, 2012 by DaveShaw
0

What resolved exact same error on SPWeb.GetList(reletiveUrl) with error thrown in method GetMetadataForUrl on SharePoint 2010:

  • restart IIS
  • restart SPTimerV4 (SharePoint 2010 Timer)
  • restart SPAdminV4 (SharePoint 2010 Administration)
answered on Stack Overflow Aug 11, 2017 by tinamou

User contributions licensed under CC BY-SA 3.0