Hi,
These days I've been reviewing different ideas I wrote down in the last months. One of those was about how to extend mobile sharepoint features. So I started re-reading the SDK, landing at How to: Customize the Mobile Home Page through Redirection article. It certainly describes in depth the mechanism of the redirection and indeed it is a great extensibility option, however I found that there are some scenarios where it would need to implement a different approach. Some of those could be:
OOB Feature Redirection
From the article we can see how this (bi-level) redirection mechanism works:
default.aspx
The first step uses the Mobility Shortcut URL feature (FeatureID: f41cc668-37e5-4743-b4a8-74d1db3fd8a4 - Name:MobilityRedirect Scope:Web) creating a Module that specifies the virtual path of the folder for the redirection.
<Module Name="mobile" Url="m" Path=""> <File Url="default.aspx" /> </Module>
This will create a folder at the root level of the Site (from a virtual point of view).
In order to test the OOB funcionality, you will need to:
figure 1
Custom Shortcut Feature Redirection
So to solve the scenarios mentioned, the new approach will use a feature to redirect to the final home page, instead of an intermediate redirection page. The feature itself would use a custom control to read the actual final page .
As the OOB feature uses /m/ I would not recommend the same name, as there will be collisions in activating and deactivating processes. Indeed you may find that after deactivating the feature it is still working. This would need to be resolved as part of a complete deactivation in the deactivation event.
So in order to accomplish our solution, we would need to create a feature with a custom shortcut url and a custom file redirect.This scenario would be possible following these steps:
<?xml version="1.0" encoding="utf-8"?><Feature Id="[GUID]" Title="Mobile Redirector" Description="Mobile Redirector" Version="1.0.0.0" Scope="Web" Hidden="FALSE" DefaultResourceFile="core" xmlns="http://schemas.microsoft.com/sharepoint/"> <ElementManifests> <ElementManifest Location="elements.xml" /> </ElementManifests></Feature>
<?xml version="1.0" encoding="utf-8"?><Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <Module Name="mobile" Url="mob" Path=""> <File Url="default.aspx" /> </Module></Elements>
<%@ Page Language="C#" EnableViewState="false" inherits="Microsoft.SharePoint.MobileControls.SPMobilePage, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%> <%@ Assembly Name="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" %> <%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register TagPrefix="SPMobile" Namespace="Microsoft.SharePoint.MobileControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %><SPMobile:SPMobileForm RunAt="Server"> <SPMobile:SPMobileUrlRedirection Runat="Server" PageFileName="[DestinationPage]" /></SPMobile:SPMobileForm>
This can be extended with some functionality/Improvements:
Finally, you can have different shortcuts changing the Url attribute of the Module node in the elements.xml file:
<Module Name="mobile" Url="i" Path=""> <File Url="default.aspx" /> </Module>
For example: Create a new shortcut called /i/ to redirect to a IPhone version, for a customized collaborative scenario.
However, in the case of a publishing site you should implement variations to target different devices.
Bye!