Asked by:
Unable to add selected web part. Exception from HRESULT: 0x80020009 (DISP_E_EXECPTION)

Question
-
I have a problem in adding webparts into my pages.
I have created a custom page (in the physical directory not by Create Page menu item in Site Actions menu) that uses a Custom MasterPage, and added the following items into the page, in order to add Web Parts into it.
In the Page header, registered the Assembly and Namespace:
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
In my Content Place Holder (PlaceHolderMain), I added the following:
<WebPartPages:WebPartZone runat="server" FrameType="TitleBarOnly" ID="Left" Title="loc:Left" />
It works fine, and the "Edit Page" menu item appears in the Site Actions menu. When I hit the Edit Page menu item, Press on the "Add a Web Part" link on the WebPart zone, and add ANY webpart, I get the following Error message:
Unable to add selected web part(s). Content Editor Web Part: Exception occured. (Exception from HRESULT: 0x80020009 (DISP_E_EXECPTION))
Any idea what does that mean?
Ahmed IG- Edited by Ahmed Mohamed ElSayed Saturday, October 4, 2008 9:23 PM
All replies
-
Go to 12hive and check your logs. Adding to this, check the event log.
There will be a detailed description of your error
Visual C# MVP | My SharePoint blog -
Thanks for your reply...
Well, I checked the log file, and got the following:
1 10/05/2008 20:45:11.73 w3wp.exe (0x0F10) 0x08B0 Windows SharePoint Services Web Parts 89ku High Failed to add webpart http%253A%252F%252Fahmed%252Dig%253A12345%252F%255Fcatalogs%252Fwp%252FMSImage%252Edwp;Image%2520Web%2520Part. Exception Microsoft.SharePoint.SPException: Exception occurred. (Exception from HRESULT: 0x80020009 (DISP_E_EXCEPTION)) ---> System.Runtime.InteropServices.COMException (0x80020009): Exception occurred. (Exception from HRESULT: 0x80020009 (DISP_E_EXCEPTION)) at Microsoft.SharePoint.Library.SPRequestInternalClass.AddWebPart(String bstrWebUrl, Boolean fAllUsers, String bstrID, String bstrWebPartTypeID, Boolean fIsIncluded, Byte bFrameState, String bstrZoneID, Int32 lPartOrder, Byte[]& ppsaAllUsersProperties, Byte[]& ppsaPerUserProperties, String[]& ppsaLinks) at Microsoft.SharePoint.Library.SPRequest.AddWebPart(String bstrWebUrl, Boolean fAllUsers, Str... 2 10/05/2008 20:45:11.73* w3wp.exe (0x0F10) 0x08B0 Windows SharePoint Services Web Parts 89ku High ...ing bstrID, String bstrWebPartTypeID, Boolean fIsIncluded, Byte bFrameState, String bstrZoneID, Int32 lPartOrder, Byte[]& ppsaAllUsersProperties, Byte[]& ppsaPerUserProperties, String[]& ppsaLinks) --- End of inner exception stack trace --- at Microsoft.SharePoint.Library.SPRequest.AddWebPart(String bstrWebUrl, Boolean fAllUsers, String bstrID, String bstrWebPartTypeID, Boolean fIsIncluded, Byte bFrameState, String bstrZoneID, Int32 lPartOrder, Byte[]& ppsaAllUsersProperties, Byte[]& ppsaPerUserProperties, String[]& ppsaLinks) at Microsoft.SharePoint.WebPartPages.SPWebPartManager.AddWebPartToStore(WebPart webPart, Int32 viewId, String viewGuid) at Microsoft.SharePoint.WebPartPages.SPWebPartManager.AddWebPartInternal(SPSupersetWebPart superset, Boolean throwIfLocked) at ... 3 10/05/2008 20:45:11.73* w3wp.exe (0x0F10) 0x08B0 Windows SharePoint Services Web Parts 89ku High ...Microsoft.SharePoint.WebPartPages.SPWebPartManager.AddWebPartInternal(SPSupersetWebPart superset) at Microsoft.SharePoint.WebPartPages.WebPartQuickAdd.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
Any idea?
Ahmed IG -
Well, it's only 3 lines of log
Try to search by "error" or name of error you got across the log with very recent date
Visual C# MVP | My SharePoint blog -
Yes try and get more detail around the error. Usually when you get a undefined com exception like this I find that it is due to permissions with accessing data from the SQL database, and this will show up in your logs.
If you still can not work out the issue try and isolate the problem by using the default master page not your custom one. If there is still an issue it will mean there is something wrong with your custom page. Make sure you page has the following structure:<%@ Page MasterPageFile="~masterurl/default.master"
Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage,
Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
meta:progid="SharePoint.WebPartPage.Document" %><%@ Register Tagprefix="WebPartPages"
Namespace="Microsoft.SharePoint.WebPartPages"
Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %><asp:Content ID="main" runat="server" ContentPlaceHolderID="PlaceHolderMain" >
<h3>Custom Web Part page</h3>
<table width="100%">
<tr>
<td valign="top" style="width:50%">
<WebPartPages:WebPartZone ID="LeftZone" runat="server"
FrameType="TitleBarOnly"
Title="Left Web Part zone" />
</td>
<td valign="top" style="width:50%">
<WebPartPages:WebPartZone ID="RightZone" runat="server"
FrameType="TitleBarOnly"
Title="Right Web Part zone" />
</td>
</tr>
</table>
</asp:Content> -
seems like the inherits tag part is the issue, how can I set the "inherits" tag to Microsoft.SharePoint.WebPartPages.WebPartPage, Microsoft.SharePoint when i already have a class I wanna inherit from, as the page has a code behind file?
The rest of the code is typical to what I have in my page, except the inherits tag.
Any suggestions?
Ahmed IG -
-
Hi,
In the assembly info file of the webpart have u added using system.security namespace and allowpartiallytrustedcallers property.Please check if not then add the above mentioned namespace and property in the assembly info file of your webpart and build the webpart and checkit again.
Regards
Dilip Kumar
Dilip Kumar Venkata