Forcing your Windows Phone 7 to update

Microsoft recently release the ‘March 2011′ (aka NoDo) phone update. Unfortunately, not all phones are updated at the same time. An update schedule has been posted here:

If your phone is listed under ‘Delivering update’, you can ‘trick’ the Zune software & your phone to get the update anyways.

1. Start Zune on Your PC
2. Turn off Data connection ( Setting >System > Mobile Network > Data Connection ) and Wifi ( Setting >System > WiFi ) on the Phone
3. Connect the Phone with the PC (via USB)
4. Start the update search in Zune ( Settings > Phone > Update )
5. About 3 seconds later, disconnect your PC from the internet (Turn WLAN off)
6. Zune finds NoDo-Update. Press OK
7. Connect to the internet again on your PC and install the update

Worked like a charm for my phone (HTC Throphy)

The full story here & here

“Unable to connect to SQL Server Instance” when installing SCVMM 2007 R2

When you try to install System Center Virtual Machine Manager 2007 R2 and configure it with an existing SQL Server installation, you must have named pipes enabled on the SQL Server. If named pipes are not enabled, you will receive the following error:

setup cannot connect to the specified sql server instance

Also, when using a SQL Server 2008 installation, you must install the SQL Server 2008 Native Client and SQL Server 2008 Command Line Utilities on the SCVMM Server. Both can be installed from the SQL Server CD or downloaded from

Running remote desktop on a Windows Server Core 2008

I am currently investigating on running hyper-v server on my development machine. The main reason is the low footprint. However, as it turns out, it is not possible to ‘connect’ to the VM’s hosted on the hyper-v server from the core box itself, as the terminal services component (aka remote desktop) is missing from the Server Core.

According to Jason Hutt’s post at you can add the TS functionality to a Server Core box by copying the following files from a Windows Server 2008 or Vista SP1 machine

  • \Windows\System32\mstsc.exe

  • \Windows\System32\mstscax.dll

  • \Windows\System32\en-US\mstsc.exe.mui

  • \Windows\System32\en-US\mstscax.dll.mui

    I have not tested this yet, but will update this post as soon as I do.

  • Using javascript in the NavigateUrlFormat property of the SPMenuField

    When you use an SPMenuField in an SPGridView, you can use the NavigateUrlFormat property to specify an url to navigate to when the users clicks the cell. Using the TokenNameAndValueFields and the NavigateUrlFields properties you can specified tokens in the Url that should be replaced with the underlying values from the datasource for each row in the grid. This all works fine, but when you try to use a javascript function in the NavigateUrlFormat property, the javascript function is never rendered.

    SPMenuField colMenu = new SPMenuField();
    colMenu.HeaderText = "Company";
    colMenu.TextFields = "Company";
    colMenu.MenuTemplateId = "mnuCompany";
    colMenu.TokenNameAndValueFields = "COMPANYID=CompanyId";
    colMenu.NavigateUrlFields = "CompanyId";
    colMenu.NavigateUrlFormat = "javascript:alert('you have clicked company with id {0}');";
    colMenu.SortExpression = "Company";

    When you start digging around in the SharePoint libraries using reflector, you’ll see that reason for this is that the code that renders the menu (Microsoft.SharePoint.WebControls.Menu.Render(HtmlTextWriter)) makes a call to ‘SPHttpUtility.HtmlUrlAttributeEncode(string url)’ passing the value of the NavigateUrlFormat (in the SPMenuField class, the value of NavigateUrlFormat is passed to the NavigateUrl property of an internally create Microsoft.SharePoint.WebControls.Menucontrol).

    The method SPHttpUtitlity.HtmlUrlAttributeEncode makes a call to SPUrlUtility.IsProtocolAllowedto verify is the requested protocol (javascript: in our case) is allowed. Since the ‘javascript’ protocal is not in the list, the link will simply not be rendered.

    The list of allowed protocols is an hardcoded string array that is initialized in the constructor of SPUrlUtility.


    static SPUrlUtility()
        m_rgstrAllowedProtocols = new string[] { "http://", "https://", "file://", @"file:\\", "ftp://", 
    		"mailto:", "msn:", "news:", "nntp:", "pnm://", "mms://", "outlook:" };


    The list of allowed protocols is available through the public AllowedProtocolsproperty, but it is read-only and since it’s an array, it’s not possible to add additional items to it.

    As a workaround, I decided to replace one of the values in the AllowedProtocols array before I render my control in the Render event and set the initial value back when the rendering is done.

    The downside of this approach is that any links using the protocol that you replace in the array will not be rendered (as it is no longer an allowed protocol). Therefore I chose to ‘replace’ one of the lesser used protocols: ‘pnm://’

    As you can imagine, this is not best practice and even not recommended. Although the AllowedProtocols property is public and therefore should always be available (then again, who will stop MS from changing the public interfaces of their classes if they really want to?).

    protected override void Render
    	SPUrlUtility.AllowedProtocols[9] = "javascript:";
        	SPUrlUtility.AllowedProtocols[9] = "pnm://";
    protected override void CreateChildControls()
    	SPGridView grid = new SPGridView();
    	SPMenuField colMenu = new SPMenuField();
    	colMenu.HeaderText = "Company";
    	colMenu.TextFields = "Company";
    	colMenu.MenuTemplateId = "mnuCompany";
    	colMenu.TokenNameAndValueFields = "COMPANYID=CompanyId";
    	colMenu.NavigateUrlFields = "CompanyId";
    	colMenu.NavigateUrlFormat = "javascript:alert('you have clicked company with id {0}');";
    	colMenu.SortExpression = "Company";
    	... (rest of code ommitted)

    Change the language of SharePoint Site(s)

    Mirjam van Olst of Macaw ( explains how to update the language of existing SharePoint sites by running a sql statement on the content datbase.

    For changing the language of all sites in the content database to Dutch the query would be:

    UPDATE dbo.Webs SET Language = 1043

    Changing the language of one site collection can be done with:

    UPDATE dbo.Webs SET Language = 1043 WHERE SiteId = [[SiteCollectionId]]

    And for changing the language of a single web or subsite you can use:

    UPDATE dbo.Webs SET Language = 1043 WHERE Id = [[WebId]]

    ‘Error in the application’ when configuring incoming e-mail on a list

    When you try to configure incoming email on a list, you might receive the error ‘Error in the application’ when the ‘Central Admin’ application pool user differs from the ‘Web Application’ application pool user.

    There might be other causes for the same symptom. For more information, see

    Handling Postbacks using MenuItemTemplate

    When using a MenuItemTemplate to perform a postback (instead of a navigate), handling the postback can be tricky. If you have several MenuItems, you will end up writing a lot of code to determine the menuitem that caused the postback and parsing the eventargument data.

    Patrick Rodgers came up with a subclassed MenuItemTemplate in this post( that targets itself for the postback and raises an event. You simply have to subscribe to the event and handle the postback there.

    Here’s Patrick’s code:

    using System;
    using System.Web.UI;
    using Microsoft.SharePoint.WebControls;

    namespace Example
    public class PostBackEventMenuItem : MenuItemTemplate, IPostBackEventHandler
    public PostBackEventMenuItem()
    : base() { }

    public PostBackEventMenuItem(string text)
    : base(text) { }

    public PostBackEventMenuItem(string text, string imageUrl)
    : base(text, imageUrl) { }

    public PostBackEventMenuItem(string text, string imageUrl, string clientOnClickScript)
    : base(text, imageUrl, clientOnClickScript) { }

    protected override void EnsureChildControls()
    if (!this.ChildControlsCreated)
    if (string.IsNullOrEmpty(this.ClientOnClickUsingPostBackEvent))

    #region IPostBackEventHandler Members

    public void RaisePostBackEvent(string eventArgument)
    EventHandler handler = this.OnPostBackEvent;
    if (handler != null)
    handler(this, new EventArgs());


    public event EventHandler OnPostBackEvent;

    To use the control, register it in an aspx page, add the PostbackEventMenuItem and subscribe to the OnPostBackEvent.

    <%@ Register TagPrefix="SharePoint" 
    Assembly="Microsoft.SharePoint, Version=, Culture=neutral,
    PublicKeyToken=71e9bce111e9429c" %>
    <%@ Register TagPrefix="Utilities"
    Assembly="Microsoft.SharePoint, Version=, Culture=neutral,
    PublicKeyToken=71e9bce111e9429c" %>
    <%@ Register TagPrefix="Example"
    Namespace="Example" Assembly="Example, Version=, Culture=neutral,
    PublicKeyToken=2bb7d29b4348a50b" %>
    <%@ Import Namespace="Microsoft.SharePoint" %>
    <%@ Import Namespace="Microsoft.SharePoint" %>
    <%@ Control Language="C#" AutoEventWireup="true"
    ClassName="Welcome" CompilationMode="Always" %>

    ToolTip="<%$Resources:wss,open_menu%>" runat="server"
    ID="ExplicitLogout" Visible="false">

    runat="server" FeatureScope="Site"
    GroupId="PersonalActions" ID="ID_PersonalActionMenu" UseShortId="true">
    runat="server" ID="ID_PersonalInformation"
    MenuGroupId="100" Sequence="100" ImageUrl="/_layouts/images/menuprofile.gif"
    UseShortId="true" />
    runat="server" id="Example_LoginAsDifferentUser"
    menugroupid="200" sequence="100" useshortid="true" ononpostbackevent="HandlePostback" />
    runat="server" ID="ID_RequestAccess"
    Description="<%$Resources:wss,personalactions_requestaccessdescription%>" MenuGroupId="200"
    UseShortId="true" Sequence="200" />
    runat="server" ID="ID_Logout"
    Description="<%$Resources:wss,personalactions_logoutdescription%>" MenuGroupId="200"
    Sequence="300" UseShortId="true" Visible="true" />
    runat="server" ID="ID_PersonalizePage"
    Description="<%$Resources:wss,personalactions_personalizepagedescription%>" ImageUrl="/_layouts/images/menupersonalize.gif"
    ClientOnClickScript="javascript:MSOLayout_ChangeLayoutMode(true);" PermissionsString="AddDelPrivateWebParts,UpdatePersonalWebParts"
    PermissionMode="Any" MenuGroupId="300" Sequence="100" UseShortId="true" />
    runat="server" ID="ID_SwitchView" MenuGroupId="300"
    Sequence="200" UseShortId="true" />
    runat="server" ID="MSOMenu_RestoreDefaults"
    ClientOnClickNavigateUrl="javascript:MSOWebPartPage_RestorePageDefault()" MenuGroupId="300"
    Sequence="300" UseShortId="true" />

    AppendCurrentPageUrl="true" Text="<%$Resources:wss,login_pagetitle%>" Style="display: none"
    Visible="false" />