Many users need to sort my sharepoint sites alpahabatically.You may do this by using following steps:-

1. Create class File


using Microsoft.SharePoint.Portal.WebControls;
using Microsoft.Office.Server.UserProfiles;
using Microsoft.SharePoint.WebControls;
using System.Collections;
using Microsoft.SharePoint;
using Microsoft.Office.Server;
using System;
namespace CustomizeMyLinks
{
           public class MyCustomLinksMenu : MyLinksMenuControl
       {
            /// <summary>
           /// Loads the menu items.
            /// </summary>
           /// <returns>a <see cref="ArrayList"/> with
           /// all the menu items from <see cref="MyLinksMenuControl.LoadMenuItems"/></returns>
            protected override ArrayList LoadMenuItems()
           {
               try
               {
                   // make sure you will call the out of the box method that generates the default items in SharePoint
                    ArrayList currentMenuItems = base.LoadMenuItems();
                   if ((currentMenuItems != null) && (currentMenuItems.Count > 0))
                   {
                       // now that you have the items, you can manipulate them the way you want
                       SubMenuTemplate customMenuTemplate;
                       using (customMenuTemplate = (SubMenuTemplate)(currentMenuItems[0]))
                       {
                            
                           customMenuTemplate.Controls.Clear();
                           ServerContext context = ServerContext.GetContext(SPContext.Current.Site);
                           UserProfileManager profileManager = new UserProfileManager(context);
                           UserProfile uProfile = profileManager.GetUserProfile(SPContext.Current.Web.CurrentUser.LoginName);
                             
                           Membership[] listOfMemberSites=null;
                           if (uProfile != null)
                           {
                               MembershipManager manager = uProfile.Memberships;
                               listOfMemberSites = manager.GetItems(MembershipSortType.Alphabetical);                             
                           }
                             
                           foreach (Membership membersite in listOfMemberSites)
                           {
                                 
                               if (membersite.GroupType.ToString() == "SharePointSite")
                               {
                                   MenuItemTemplate menu = new MenuItemTemplate();
                                   menu.Text = membersite.Title;
                                   menu.ClientOnClickNavigateUrl = membersite.Url;
                                   customMenuTemplate.Controls.Add(menu);
                               }
                           }
                             
                       }
                   }
                     
                   return currentMenuItems;
               }
               catch (Exception ex)
               {
                   return null;
               }
           }
       }
   }

2. ASCX file and new folder

 Create a ascx file & create a new folder MyCustomLinksMenu,copy ascx file and copy this folder in controltemplates folder of 12 hive.

<%@ Control className="MyLinksUserControl" Language="C#" Inherits="Microsoft.SharePoint.Portal.WebControls.MyLinksUserControl&#44;Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<%@ Register Tagprefix="OSRVWC" Namespace="Microsoft.Office.Server.WebControls" Assembly="Microsoft.Office.Server, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<%@ Register Tagprefix="SPSWC" Namespace="CustomizeMyLinks" Assembly="CustomizeMyLinks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=dcdc118343c8cf35" %>

<%@ Register Tagprefix="SPSWCa" Namespace="Microsoft.SharePoint.Portal.WebControls" Assembly="Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<table><tr>

<td class="ms-globallinks"><SPSWC:MyCustomLinksMenu id="MyLinksMenu" runat="server" /></td>

<td class="ms-globallinks"><asp:Literal id="hlMySiteSpacer" runat="server" /></td>

</tr></table>

3. Feature folder

Create a Feature folder "CustomizeMyLinks",create feature,element xml file and copy folder into features folder of 12 hive.

Feature.xml-

<?xml version="1.0" encoding="utf-8"?>
 
<Feature Id="6fed26c0-57d3-4237-afd7-722c5c13a147"
 
         Title="Customize MyLinks menu control"
 
         Description="Sort the My Sharepoint Sites Links"
 
         Version="1.0.0.0"
 
         Hidden="FALSE"
 
         Scope="Farm"
 
 
         ImageUrl ="">
 
   <ElementManifests>
 
        <ElementManifest Location="elements.xml"/>
 
  </ElementManifests>
 
</Feature>

Element.xml-


 
    <Control Id="GlobalSiteLink1" Sequence="100" ControlSrc="~/_controltemplates/mysitelink.ascx" />
 
    <Control Id="GlobalSiteLink2" Sequence="99" ControlSrc="~/_controltemplates/MyCustomLinksMenu/MyCustomLinksMenu.ascx"/>
 
    <Control Id="ProfileRedirection" Sequence="100" ControlSrc="~/_controltemplates/mysiteredirection.ascx"/>
 
</Elements>

4. Deploy DLL

Deploy the dll in gac & add safecontrol in web.config

<SafeControl Assembly="CustomizeMyLinks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=dcdc118343c8cf35" Namespace="CustomizeMyLinks" TypeName="*" Safe="True" />

You may also create a wsp package of all code & deploy to SharePoint.

Now, All My SharePoint Sites in My Links control are alphabetically sorted.