Unable to cast COM object of type 'Microsoft.SharePoint.Library.SPRe questInternalClass'
Every so often (rarely) when interacting with one of our custom web parts in SharePointwe recieve a rather obscure SharePoint error: Unable to cast COM object of type 'Microsoft.SharePoint.Library.SPRequestInternalClass' to interface type 'Microsoft.SharePoint.Library.ISPRequest'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{BDEADEBE-C265-11D0-BCED-00A0C90AB50F}' failed due to the following error: Bad variable type. (Exception from HRESULT: 0x80020008 (DISP_E_BADVARTYPE)). Searching the web I see that others have had this problem but there has been very little explanation as to what might cause it - although I saw one suggestion that it may be related to remoting or authentication? The usual pattern is that the error occurs the FIRST time the web part is used - but then we can carry on without any issues. Based on the little information I have managed to find I am convinced this it's not our web part at fault - but has anyone suffered the same error or can throw any light onto what might cause this?
February 12th, 2008 2:44pm

Run it using elevated privileges...mine got resolved. http://msdn2.microsoft.com/en-us/library/microsoft.sharepoint.spsecurity.runwithelevatedprivileges.aspx
Free Windows Admin Tool Kit Click here and download it now
June 10th, 2008 7:49am

Mine never resolved, and the error appears on a SPSite constructor, but not every time. Maybe 5-6 time I call my method succesfully, and next time I get the error. DarkoDarko Milevski
January 27th, 2009 5:33pm

Any one knows the solution for this. I am also getting this error when I try to create a SPSite object. The code works for me for the first time when I install the dlls to the GAC and reset IIS. Some times it works for twice. But after that I get this error.Unable to cast COM object of type 'Microsoft.SharePoint.Library.SPRequestInternalClass' to interface type 'Microsoft.SharePoint.Library.ISPRequest'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{BDEADEBE-C265-11D0-BCED-00A0C90AB50F}' failed due to the following error: Bad variable type. (Exception from HRESULT: 0x80020008 (DISP_E_BADVARTYPE))I am using SPSecurity.RunWithElevatedPrivileges too.Thanks-Sachith
Free Windows Admin Tool Kit Click here and download it now
January 29th, 2010 5:03pm

Any one knows the solution for this. I am also getting this error when I try to create a SPSite object. The code works for me for the first time when I install the dlls to the GAC and reset IIS. Some times it works for twice. But after that I get this error.Unable to cast COM object of type 'Microsoft.SharePoint.Library.SPRequestInternalClass' to interface type 'Microsoft.SharePoint.Library.ISPRequest'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{BDEADEBE-C265-11D0-BCED-00A0C90AB50F}' failed due to the following error: Bad variable type. (Exception from HRESULT: 0x80020008 (DISP_E_BADVARTYPE))I am using SPSecurity.RunWithElevatedPrivileges too.Thanks-Sachith I was trying to do some update to a SharePoint list.I was calling trying to do this within a method where I was doing some excel reading. I found the problem was there. I changed my code in a way that I exited from the method in which I was working with excel and called these sharePoint method out side that.Then I didn't get the above error.Hope this information will help you,Thank you,sachith
February 1st, 2010 5:22pm

Had the same error. Mine occurred because I was trying to access an SPList object from a backgroundworker process. When I changed my code so I fetched these objects from within the bgw, the error was gone. So it seems that these SP objects work similar as GUI objects. You cannot reference a GUI object from within a bgw (that's why you need the progressupdated event), and it seems to be the same for SP objects.
Free Windows Admin Tool Kit Click here and download it now
December 17th, 2010 9:41am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics