Post

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

1
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:

1
ObjectDataSource ds = new ObjectDataSource("MyNameSpace.MyClass", "GetObjects");

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

1
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 list of the section, like this:

1
2
3
4
5
6
<compilation batch="false" debug="false">
<assemblies>
  <add assembly="MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=123456789ABCDEF" />
</assemblies>

......

And now it worked.

This post is licensed under CC BY 4.0 by the author.