Exercise 2: Configure SharePoint for Windows Phone 7 Mobile Views

In the previous exercise, you manually forced the Windows Phone 7 browser to load the SharePoint mobile view. This was required because the default browser definition file for the site does not include a definition for Windows Phone 7 devices. In this exercise you will edit the browser definition file for the FBA team site so that Windows Phone 7 will automatically redirect to the mobile view.

Task 1 – Editing the Browser Definition File

In this task, you will edit the default browser definition file (compat.browser) and change the behavior of the Windows Phone 7 browser to automatically redirect to mobile views. There is a compat.browser file for each SharePoint Web Application.

  1. On the server hosting your SharePoint site, launch Internet Information Services (IIS) Manager by clicking Start | Run and typing INETMGR.
  2. In Internet Information Services (IIS) Manager expand the Sites node and locate the site you created in Setting Up A SharePoint and Windows Phone 7 Development Environment Module titled FBAWP7. Right click the site and choose Explore.
  3. In Windows Explorer, double click the App_Browsers folder.
  4. Open compat.browser in a text editor.
  5. Find the <browser> node that has the id OfficeMobileClient. Create a new line below the closing tag of the browser definition </browser>.
  6. Add the following definition to the file by pasting it on the new line. Be certain that you are below the </browser> tag and before the comment.

    XML

    <!-- Case: Windows Phone 7 phone browser Desktop Mode --> <!-- User Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; XBLWP7; ZuneWP7) --> <browser id="IE7MobileDesktopMode" parentID="IE6to9"> <identification> <userAgent match="XBLWP7" /> </identification> <capabilities> <capability name="supportsTouchScreen" value="true" /> </capabilities> </browser> <!-- Case: Windows Phone 7 phone browser Mobile Mode --> <!-- UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0; Microsoft; XDeviceEmulator) --> <!-- UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0; SAMSUNG; SGH-i917) --> <browser id="IE7MobileMobileMode" parentID="IE6to9"> <identification> <userAgent match="(?i)Windows Phone OS\s7\.\d.*IEMobile/(?'version'\d+)\.(?'minor'\d+)" /> </identification> <capabilities> <capability name="browser" value="IE Mobile" /> <capability name="canInitiateVoiceCall" value="true" /> <capability name="isMobileDevice" value="true" /> <capability name="javascript" value="true" /> <capability name="optimumPageWeight" value="1500" /> <capability name="tables" value="true" /> <capability name="version" value="${version}" /> <capability name="supportsTouchScreen" value="true" /> </capabilities> </browser>

    The above XML will match on the User-Agent string passed by Windows Phone 7 and detect the browser setting for Mobile or Desktop. The Capabilities section then defines the features supported by the phone. The most important capability is the isMobileDevice setting. If true SharePoint will redirect to mobile views.

  7. Save your changes to the compat.browser file.
  8. Restart IIS by entering the following command at the command prompt:

    iisreset /noforce.

Task 2 – Testing the Windows Phone 7 Browser Redirection

In the previous task, you change the mobile browser configuration so that SharePoint would automatically redirect the Windows Phone to use SharePoint Mobile pages. In this task, you will test the functioning of the mobile browser redirection.

  1. Open the Windows Phone 7 Emulator.
  2. Click Internet Explorer. In the address bar, enter the address of the FBA site: https://fbawp7.
  3. After a moment you should be redirected to the mobile login page for SharePoint. (https://fbawp7/_layouts/mobile/mblmultilogin.aspx)

    Figure 8

    SharePoint Mobile Login Selector

  4. Ensure that Forms Authentication is selected and click OK.
  5. On the Sign In page, enter the credentials AdamB and pass@word1. Click Sign In.

    Figure 9

    SharePoint Mobile Login Dialog

  6. You are redirected to the mobile view of the pages in the site without having to perform any manual intervention.

    Figure 10

    SharePoint Mobile Home Page