Visual Studio and SharePoint 2010 new SPSite returns FileNotFoundException

March 22, 2010   13:26


While writing my first console application to communicate with SharePoint 2010, I was surprised to receive a FileNotFoundException during the creation of a new SPSite.

The line

SPWeb web = new SPSite(”http://localhost/”).OpenWeb();

returned the error statement:

FileNotFoundException was unhandled:
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.

FileNotFoundException

At first I assumed that the error was caused by invalid user rights, but after some searching this forum post at Microsoft Technet came up with the right solution.

By default the console project is build for the .Net 4 framework and and the x86 platform. Because SharePoint is only available as a 64bit version, the console app should also be compiled for the 64bit platform.

Update_Platform_To_x64_FileNotFoundException

By changing the framework to .Net 3.5 and the target platform to x64 the issue was resolved.

Tags: , , , , , , , , , .





SharePoint 2010 Mobile Web Part development

January 17, 2010   22:15


mobiledevice For a SharePoint 2010 demo i’m building a web part that should be accessible by Mobile devices. In SharePint 2010 all mobile devices are redirected by default to the mobile SharePoint rendering engine.

The mobile rendering engine of SharePoint provides mobile users access to the sites with a completely stripped interface. Its main function is to list all libraries and to provide basic access to them. For wiki and blog sites the rendering engine also provides some content rendering.

To keep the amount of data as low as possible, almost all web parts are completely stripped from the mobile site. Only when a web part developer provided a special mobile version of the web part, the web part will be accessible in the interface and to keep the mobile screen as empty as possible, the user must first expand the web part via its title to see it.

Documentation about SharePoint Mobile development is provided at MSDN. At first it all looks quite complex, but building a mobile version of a web part is actually not that hard. Below I will explain the required steps with a ‘Hello world’ example. For this sample I will not rename the default object names provided by the Visual Studio templates.

(more…)

Tags: , , , , .









The content expressed in this blog are those of Edwin Vriethoff and do not represent his employer's view in anyway. The contents of this blog has been carefully put together, but Edwin Vriethoff is not responsible in any way for any direct or indirect harm caused by individuals or organizations using the content of this blog in any way.