How to fix the The type specified in the TypeName property of ObjectDataSource could not be found error in a SharePoint custom solution

The type specified in the TypeName property of ObjectDataSource could not be found error

I was coding away happily developing a custom Reporting Services report for a SharePoint Web Part. The Web Part hosts a local Reporting Services report (.rdlc) and it’s using an ObjectDataSource as the data source, and I was getting the type specified in the TypeName property of ObjectDataSource could not be found error.

So in my code I have a data class with a select method, so my constructor looks like this:

ObjectDataSource ds = new ObjectDataSource(“MyNameSpace.MyClass”, “GetObjects”);

However, when executing the report, I got this error:

The type specified in the TypeName property of ObjectDataSource ” could not be found

I had put my assembly in the SafeControl section in Web.config, and the assembly was in the GAC.

It turns out that it also needs to be referenced in the <assemlbies> list of the <compiliaton> section, like this:

<compilation batch=”false” debug=”false”>

<assemblies>

<add assembly=”MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=123456789ABCDEF” />

</assemblies>

……

And now it worked.

5 thoughts on “How to fix the The type specified in the TypeName property of ObjectDataSource could not be found error in a SharePoint custom solution

  1. Excellent. But how would you deploy this as part of a package?

    Would you need to write a feature that manually alters the web.config?

Leave a Reply

Your email address will not be published. Required fields are marked *