Sharepoint GetList or GetListFromUrl fails (0x80070001 or 0x80004005)

maybe it looks like this
 Microsoft.SharePoint.SPException ---> System.Runtime.InteropServices.COMException: <nativehr>0x80070001</nativehr><nativestack></nativestack>

anyway, the problem might be that you changed context, you're in a handler (Ajax request), or moved references of SPContext or SPSite to a mehtod, or opened a new site and web.

the 2 methods above, GetList or GetListFromUrl, usually will work with non-100%-complete parameters, like "/Pages", but with the context a bit changed it must have the 100% parameters.

the GetListFromUrl just need "/Forms/AllItems.aspx" in the end, while the GetList need the full url, so try this:

web.GetList[site.MakeFullUrl("url part")]

and if your "url part" is just "/Pages" add web url like this:

web.GetList[site.MakeFullUrl(web.ServerRelativeUr + "url part")]


Comments

Popular posts from this blog

c# Service Play Sound with NAudio example by Moshe

JS/JQ simulate Enter event

SOLVED The item could not be indexed successfully because the item failed in the indexing subsystem