MOSS Forum

Ask Question   UnAnswered
Home » Forum » MOSS       RSS Feeds

Error: Unable to add selected webparts. Cannot import this webpart.

  Asked By: Sampat    Date: Jun 05    Category: MOSS    Views: 5344

Does anybody have any idea why we would receive this error? "Unable to
add selected webparts. Cannot import this webpart."

We have tried to add some basic custom webparts to a site in our Moss
2007 installation (in preparation to add a not-so-basic custom
webpart) - but all the custom webparts give this error. All of the
built-in webparts that we tried so far work just fine.



4 Answers Found

Answer #1    Answered By: Deven Gajjar     Answered On: Jun 05

Have you put the assemblies and descriptions in the GAC or /bin ?

Some installation  programs do this for you. How are you installing them?

Answer #2    Answered By: Latisha Schneider     Answered On: Jun 05

Double check the source code of the custom webparts  you are trying to add.
Make sure that the class which is the webpart  itself is marked as Public.
If it is then you probably have something wrong in the .webpart file that
you are using. Most common error  is a mismatch between the namespace and
classname entries in the file. Last but not least, do you have a valid
SafeControls entry in the web.config of the site. These are the 3 most
common reasons for that error.

Answer #3    Answered By: Nora Maxwell     Answered On: Jun 05

We have yet to figure out this problem - are there any server/MOSS
configuration settings that we could check that might be affecting
custom web parts?

Answer #4    Answered By: Corina Duran     Answered On: Jun 05

Here is the laundry list of things to check.

1) Is the class that is the webpart  in the DLL marked as 'PUBLIC'.
Adding a Class file to an existing file does not default the class to
'Public'. If its not you won't be able to add  it to SharePoint

2) Do you have a proper SafeControl entry for the webpart in the

3) Is the Webpart DLL in the Bin directory of the website or the GAC?
It must be in one or the other.

4) Do the names in the .webpart (.dwp) file match then names and
namespace of the webpart code file?

This error  usually happens because the .webpart (or .dwp) file is loaded,
but the .dll isn't loaded or the webpart in the dll isn't available or can't
be seen.