Error: The type or namespace name ‘xxx’ could not be found

Today I ran into a small programming related issue. As I was working on a webpart, I was trying to use an UpdatePanel control. So I referenced the System.Web and added the using statements:

  • using System.Web;
  • using System.Web.UI;

But still got me the nasty The type or namespace name ‘UpdatePanel’ could not be found (are you missing a using directive or an assembly reference?) 

Well of course not I added all the needed directives and assemblies. Or didn’t I?

UpdatePanel is an extension, it used to be in the Atlas library which later became Ajax.NET so don’t forget to also reference System.Web.Extensions. This should solve your problems. As it is plain .NET code it is something that works in SharePoint as well as other .NET applications.

Can be a tricky little thing, and of course it doesn’t only go for the update panel but for all the Ajax controls.

So that’s it for now, hope to see you soon, untill then happy SharePointing.

Error: Feature ‘GUID’ for list template ‘XXX’ is not installed in this farm. The operation could not be completed.

While playing around in an existing SharePoint environment I came across the following error: Feature ‘GUID’ for list template ‘XXX’ is not installed in this farm. The operation could not be completed. It occured while clicking on a list, I wanted to delete it. The cause of the problem is probably that someone deleted the feature that came with this list. A colleague of mine told me that I perhaps could delete it by manually changing the url: http://SharepointUri/_layouts/listedit.aspx?List=SomeGuid. It displays the list settings. To do that you first need to get the list Guid, that was the second challenge, there was no way for me to get the guid because I need the settings page to see the Guid. So I decided to write a small program to get the Guid of a certain list. After obtaining it I used it with the url but to no avail, I got the same error.

After searching the internet I came across 2 possible solutions, use stsadmin with a forcedelete command or use PowerShell. And I found out PowerShell is the way to go. It is a commandline tool with a syntax much like C#:

$w = Get-SPWeb “http://MySharePointURI”

$w.Lists.Delete([System.Guid]$w.Lists[“List Name To Delete”].ID)

What we do here is set “w” to be instantiated with the web that holds the list. Next call the delete method on the list collection of the instantiated obeject. The Delete method takes a Guid. We get the Guid with $w.Lists[“List Name To Delete”].ID it gets the Guid based on the name of the list.

Error: The Web application at http://localhost/ could not be found

Ok, so I’ve run into the first (small) problem. As I was working on a small tool (which is supposed to solve another small problem I ran into), which retrieves all lists in a certain web, I immediately ran into a problem. Figures, problems with the first line of code. Good excuse to post some code and try this wp-plugin. As I am pretty new to this SharePoint coding, I am open for suggestions and tips and will adjust articles and code accordingly.

 C# |  copy code |? 
            using (SPSite site = new SPSite("http://localhost/"))
                 using (SPWeb web = site.OpenWeb(""))
                     foreach (SPList l in web.GetListsOfType(SPBaseType.GenericList))
                         Guid myGuid = l.ID;
                         string strName = l.Title;

I got the following error message:

The Web application at http://localhost/ could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.

The solution was very simple, the target platform is x64 while a new project by default targets x86. So go to the menu Build -> Configuration Manager and change the active platform to x64.