Checklist: Cannot import webpart

While importing (drag/drop) your webpart to any SharePoint page, if you receive an error stating ‘Cannot import webpart’ or ‘unable to add selected web part(s)’… here is the check list you should look for:

  1. Make sure the webpart class is inherited either from Microsoft.SharePoint.WebPartPages.WebPart or System.Web.UI.WebControls.WebParts.WebPart
  2. The webpart class needs to be declared public.
  3. Safe controls entry in web.config file.
  4. If you are referring a webpart from GAC (i.e. assembly containing webpart class is placed in GAC) make sure the GAC version is the latest build and IIS is re-started.

- Ankit

SharePoint: ServerContext not set to an instance

I was playing through SharePoint object model and somewhere (don’t remember right now!) got an exception stating “ServerContext not set to an instance”.

My solution for this: Installed SSP (Shared Services Provider) and this problem is solved!
[ Edited:2008-03-24
I got this error while playing with stsadm.exe command
]