I got the following exception when I add the custom web part.
Unable to add selected web part(s).
WPIndexingOutcomeSummary: Exception occured. (Exception from HRESULT: 0x80020009 (DISP_E_EXCEPTION)
There is very little information MOSS 2007 leaves for such exception. (The SharePoint 2010 is better in this space). But anyhow I had logs/blogs and reading I was able to narrow down the error using this blog.
By reading the blog I did not get any information what is the cause and resolution. Specially read the comments lines by Mark Strokes. Also best practices is http://msdn.microsoft.com/en-us/library/aa973248(office.12).aspx
Mark Stokes – Sept. 23, 2008
I also had this issue and in my case, it was because my web part was accidentally putting a using statement around SPWeb web = SPContext.Current.Web
Bad Bad. Correcting this sorted the problem.
CAUSE
To add any web part in the MOSS 2007 site on the XXXX Client Site Def sites it threw the following exception. In the ULS logs the following was the information thrown for any web part(s) (Custom or OOB). The key error message is highlighted in yellow.
01/28/2011 08:21:32.23 w3wp.exe (0x1350) 0x0C24 Windows SharePoint Services General 8e2s Medium Unknown SPRequest error occurred. More information: 0x80020009
01/28/2011 08:21:32.52 w3wp.exe (0x1350) 0x0C24 Windows SharePoint Services Web Parts 89ku High
Failed to add webpart http%253A%252F%252Fwin%252Dc0mtbrojocq%253A22222%252Fsites%252FDemo%252F%255Fcatalogs%252Fwp%252FMSContentEditor%252Edwp;Content%2520Editor%2520Web%2520Part.
Exception Microsoft.SharePoint.WebPartPages.WebPartPageUserException: Exception occurred. (Exception from HRESULT: 0x80020009 (DISP_E_EXCEPTION))
at Microsoft.SharePoint.WebPartPages.SPWebPartManager.SaveSomeChanges(SPLayoutProperties layoutProperties)
at Microsoft.SharePoint.WebPartPages.WebPart.SaveSomeChanges(SPLayoutProperties layoutProperties)
at Microsoft.SharePoint.WebPartPages.SPWebPartManager.WPSaveSomeChanges(SPLayoutProperties layoutProperties)
at Microsoft.SharePoint.WebPartPages.SPWebPartManager.MakeSpaceForWebPart(WebPart webPartToPlace, Int32 zoneIndex, String zoneID, Boolean storeInPendingChangesList)
at Microsoft.SharePoint.WebPartPages.SPWebPartManager.OnWebPartAddingCore(SPSupersetWebPart superset, Boolean throwIfLocked)
at Microsoft.SharePoint.WebPartPages.SPWebPartManager.AddWebPartInternal(SPSupersetWebPart superset, Boolean throwIfLocked)
at Microsoft.SharePoint.WebPartPages.SPWebPartManager.AddWebPartInternal(SPSupersetWebPart superset)
at Microsoft.SharePoint.WebPartPages.WebPartQuickAdd.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
RESOLUTION
In the code there were three files used the line within using statement.
“using (SPWeb web = SPContext.Current.Web)”
The three files are:
C:\DMS\DMS\Source Code\UI\Web\WebForms\IndexingPage.aspx.cs(26): //using (SPWeb web = SPContext.Current.Web)
C:\DMS\DMS\Source Code\UI\Web\WebForms\ViewIndexingProperties.aspx.cs(162): //using (SPWeb web = SPContext.Current.Web)
C:\DMS\DMS\Source Code\UI\Web\Webparts\CAEL.DMS.UI.Webparts\Administration.cs(35): //using (SPWeb web = SPContext.Current.Web)
I commented the using keyword and recompiled the code and deployed to VM I was able to add the web part.
So in summary:
- The SPContext.Current.Web should NEVER be within using statement. By putting in the using statement it is automatically destroyd and it should never be destroyed.
- Since the above “SPContext.Current.Web” was used in the using statement at later time when I tried to add the web part I got the exception “ Unknown SPRequest error occurred. More information: 0x80020009” in the ULS log.
- By commenting the using statement and accesing the variable “SPContext.Current.Web” as is correct fix.
I hope if you get similar error and this information helps you.
Thanks,
-Pankaj Surti
Hi, I am getting this error in timer job and I am unable to find out the cause, can you please help me
Unknown SPRequest error occurred. More information: 0x80070003
0x80070003
0x80070003: at Microsoft.SharePoint.Library.SPRequestInternalClass.GetSiteFlags(String bstrUrl) at Microsoft.SharePoint.Library.SPRequest.GetSiteFlags(String bstrUrl) at Microsoft.SharePoint.SPSite.get_ReadLocked() at ABC.SharePoint.ProfileCleanup.Framework.ProfileCleanup.ProcessActiveItemsInCleanUpList(String username, SimpleUser manager, String strCleanupDate, Boolean boolIsCleanUp, StringBuilder& sbStatistics) at ABC.SharePoint.ProfileCleanup.Framework.ProfileCleanup.ProcessActiveItems(SPWeb web)