Mobile development Cross devices SharePoint

mobiledeviceFor 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.

Create a sample site
Create a sample site

In this sample we begin with a fresh empty site. Create a new “Blank Site” and call it “Mobile Demo”.

Create a Visual Studio 2010 Visual Web Part Project

Visual studio 2010 includes a full set of SharePoint templates. These templates automatically publish and debug the project to your SharePoint environment.

Create a Visual Studio 2010 Visual Web Part ProjectStart a new “Visual Web Part Project” and name it “MobileWebPartDemo”.

Add a literal with the “hello world” message

We will now create the normal SharePoint web part. We only show a sample message by adding a literal to the web part controls.

Open the class file “VisualWebPart1UserControl.ascx.cs” and add the following code to the load event:

Literal litHello = new Literal;
litHello.Text = “Hello World. This is the normal SharePoint web part.”;
Controls.Add(litHello);

Build and add the web part to the page

Press F5 to compile and build the web part. Internet explorer will start. Browse to the “Mobile demo” sample site and open the default page in edit mode. Add a new web part. Inside the “Custom” category you will find our demo web part. Add “VisualWebPart1” to the page.

Preview the site

Exit the edit mode of the page. You will now see your site and the web part as normal users will see it.

Preview the mobile site

To view the web site in mobile view, type a “/m” after the normal site url. For example: “

Add a literal with the “hello world” message Build and add the web part to the page Preview the mobile site Configure the compat.browser file to use our mobile web part

You might also like

Nikolai Onken - Creating Cross-plattform Mobile
Nikolai Onken - Creating Cross-plattform Mobile ...
Web & Mobile Development made easy with Omnis Studio
Web & Mobile Development made easy with Omnis Studio
Connecting Cross Platform Devices using Windows Azure
Connecting Cross Platform Devices using Windows Azure ...
Lessons from the Mobile Development battlefield - Mark Kellett
Lessons from the Mobile Development battlefield - Mark Kellett

Why old iPhones become sluggish over time  — Macworld
One of the unusual consequences of being in the computer business is that I tend to own more devices than the average person.