Nov 02 2010

Creating a Custom Welcome Menu for SharePoint Server 2010 – Part 3

Category: ASP.NET, SharePoint, TechnologyAdam Toth @ 4:20 pm

Part 3 – Sign Out/Sign in as a Different User

A project I am working on called for a custom implementation of the SharePoint Welcome menu control. The replacement control needed to provide the following:

  • Implement the look and behaviors that the designers created.
  • Exclude some default SharePoint menu items (such as My Regional Settings).
  • Reuse some existing SharePoint menu items (such as Sign Out/Sign in as a Different User).
  • Allow for the addition of other custom menu items in the future.
  • Display thumbnail of the user’s profile picture.

I had to create a control that looked and behaved like the following:

CropperCapture2_thumb1_thumb

The designers came up with some clean, semantic markup married with some jquery, for me to start from:

<div class="header">

    <img class="header-logo" src="/images/header_logo.png" alt="" width="169" height="78" />

    <div class="header-bar">

        <div class="profile_menu">

            <a href="#" class="profile_btn">

                <span class="image"><img src="" style="width:20px;height:20px" /></span>

                <span class="name">John Doe</span>

                <span class="arrow"></span>

            </a>

            <div class="profile_dropdown">

                <div class="dropdown_bkgrd">

                    <ul>

                        <li>Edit Profile</li> 

                        <li>My Site</li>

                        <li>Log Out</li>                        

                        <li>Sign in as a Different User</li>

                    </ul>

                </div>

            </div>

        </div>

    </div>

</div>

This is part 3 of a three part series.

  1. Part 1 – Overview, Profile Picture, and User Name
  2. Part 2 – Edit Profile and My Site links
  3. Part 3 – Sign Out/Sign in as a Different User

Continue reading “Creating a Custom Welcome Menu for SharePoint Server 2010 – Part 3″

Tags: , ,


Nov 02 2010

Creating a Custom Welcome Menu for SharePoint Server 2010 – Part 2

Category: ASP.NET, SharePoint, TechnologyAdam Toth @ 4:10 pm

Part 2 – Edit Profile and My Site links

A project I am working on called for a custom implementation of the SharePoint Welcome menu control. The replacement control needed to provide the following:

  • Implement the look and behaviors that the designers created.
  • Exclude some default SharePoint menu items (such as My Regional Settings).
  • Reuse some existing SharePoint menu items (such as Sign Out/Sign in as a Different User).
  • Allow for the addition of other custom menu items in the future.
  • Display thumbnail of the user’s profile picture.

I had to create a control that looked and behaved like the following:

CropperCapture2_thumb1

The designers came up with some clean, semantic markup married with some jquery, for me to start from:

<div class="header">

    <img class="header-logo" src="/images/header_logo.png" alt="" width="169" height="78" />

    <div class="header-bar">

        <div class="profile_menu">

            <a href="#" class="profile_btn">

                <span class="image"><img src="" style="width:20px;height:20px" /></span>

                <span class="name">John Doe</span>

                <span class="arrow"></span>

            </a>

            <div class="profile_dropdown">

                <div class="dropdown_bkgrd">

                    <ul>

                        <li>Edit Profile</li>

                        <li>My Site</li>

                        <li>Log Out</li>

                        <li>Sign in as a Different User</li>

                    </ul>

                </div>

            </div>

        </div>

    </div>

</div>

This is part 2 of a three part series.

  1. Part 1 – Overview, Profile Picture, and User Name
  2. Part 2 – Edit Profile and My Site links
  3. Part 3 – Sign Out/Sign in as a Different User

Continue reading “Creating a Custom Welcome Menu for SharePoint Server 2010 – Part 2″

Tags: , ,


Nov 02 2010

Creating a Custom Welcome Menu for SharePoint Server 2010 – Part 1

Category: ASP.NET, SharePoint, TechnologyAdam Toth @ 4:00 pm

Part 1 – Overview, Profile Picture, and User Name

A project I am working on called for a custom implementation of the SharePoint Welcome menu control. The replacement control needed to provide the following:

  • Implement the look and behaviors that the designers created.
  • Exclude some default SharePoint menu items (such as My Regional Settings).
  • Reuse some existing SharePoint menu items (such as Sign Out/Sign in as a Different User).
  • Allow for the addition of other custom menu items in the future.
  • Display thumbnail of the user’s profile picture.

I had to create a control that looked and behaved like the following:

CropperCapture[2]

The designers came up with some clean, semantic markup married with some jquery, for me to start from:

<div class="header">

    <img class="header-logo" src="/images/header_logo.png" alt="" width="169" height="78" />

    <div class="header-bar">

        <div class="profile_menu">

            <a href="#" class="profile_btn">

                <span class="image"><img src="" style="width:20px;height:20px" /></span>

                <span class="name">John Doe</span>

                <span class="arrow"></span>

            </a>

            <div class="profile_dropdown">

                <div class="dropdown_bkgrd">

                    <ul>

                        <li>Edit Profile</li> 

                        <li>My Site</li>

                        <li>Log Out</li>                        

                        <li>Sign in as a Different User</li>

                    </ul>

                </div>

            </div>

        </div>

    </div>

</div>

This is part 1 of a three part series.

  1. Part 1 – Overview, Profile Picture, and User Name
  2. Part 2 – Edit Profile and My Site links
  3. Part 3 – Sign Out/Sign in as a Different User

Continue reading “Creating a Custom Welcome Menu for SharePoint Server 2010 – Part 1″

Tags: , ,


Oct 15 2010

Adding and Deploying Generic Handlers (.ashx) to a SharePoint 2010 Visual Studio Project

Category: ASP.NET, SharePoint, TechnologyAdam Toth @ 2:00 pm

Generic Handlers (.ashx files) deployed to the _layouts directory are not directly supported by Visual Studio 2010 SharePoint projects like custom .aspx application pages are.

If you try to Add New Item… and select the Web or SharePoint categories in a VS 2010 SharePoint project, you won’t find Generic Handler anywhere.

image

You’ll find ASP.NET Handler, but this will require you to create entries in web.config to make your handler work. In order to add a new .ASHX generic handler and get it to deploy properly, you can use the following steps:

  • Right-click the project, and select Add New Item…
  • Choose the Application Page template.
  • In the name box, enter a name for your file, with an .ashx extension.
    image
  • Open the .ashx file, delete the contents and replace with the following, changing your Class= attribute with your desired namespace and class name:
    <%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>

    <%@ Assembly Name="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

    <%@ WebHandler Language="C#" Class="MyNamespace.MyGenericHandler" %>

    Note: If you want to reference other SharePoint assemblies in your code-behind, you will need to add an @ Assembly directive for each DLL.

  • Open the ashx.cs file.
    • Add a using statement for System.Web.
    • You probably don’t need the using statement for Microsoft.SharePoint.WebControls, so remove it.
    • Change your namespace if necessary.
    • Change the class to inherit from IHttpHandler.
    • Implement the IHttpHandler interface. Your code should now look something like this:Â
      using System;

      using Microsoft.SharePoint;

      using System.Web;

       

      namespace MyNamespace

      {

          public partial class MyGenericHandler : IHttpHandler

          {

       

              #region IHttpHandler Members

       

              public bool IsReusable

              {

                  get { throw new NotImplementedException(); }

              }

       

              public void ProcessRequest(HttpContext context)

              {

                  throw new NotImplementedException();

              }

       

              #endregion

          }

      }

  • In the Solution Explorer, delete the ashx.designer.cs file, it is not needed.
  • In the Solution Explorer, click the .ashx file, and in the Properties pane, set the Build Action to Content.
  • In the Solution Explorer, click the .ashx.cs file, and in the Properties pane, set the Build Action to Compile.
  • Make sure to enable Token replacement for .ashx extensions. This will replace the $SharePoint.Project.AssemblyFullName$ token with the full strong name of your assembly, enabling you to reference other classes in your compiled assembly from the ashx code-behind.You can read more about token replacement here. To enable this for your Project, Unload your Project, Edit the .csproj file and add the following text to a PropertyGroup, and Reload your project:
    <PropertyGroup>

      <TokenReplacementFileExtensions>ashx</TokenReplacementFileExtensions>

    </PropertyGroup>

Tags: , , ,


Nov 18 2009

PDC Day 1 – Lap Around Windows Azure Notes

Category: ASP.NET, Azure, WCF, WFAdam Toth @ 9:02 am

    Session #1:

    Windows Azure Platform:

  1. Windows Azure
  2. SQL Azure
  3. AppFabric

    …plus developer tools and "Dallas"

    Azure does "Compute" "Management" and "Storage"

    SQL Azure is a relational DB as a service.

    Demo is of a tickmaster-type application that uses Azure.

    TicketDirect Architecture:

    "Compute" using Web and Worker roles to process tickets

    Using the service bus to communicate with on-premise services.

    Storage of data in SQL Azure

    Printing of tickets is offloaded to the site (i.e. venue).

    Site receives a message via service bus to print the ticket for pickup at role call

Another Demo, sample app, of basic CRUD web app.

CRUD is standard ASP.NET SqlDataSource control with SQL commands, that works with SQL Express but runs in the cloud

Demo’d using Trace.Write which writes out to the development console logger and can also write to the Azure Storage logging subsystem

Migrated to SQL Azure by just changing the connection string

Storage (BLOBs, Tables, and Queues)

NEW – Add ability to mount Azure storage as NTFS drive

Coming soon – Ability to manage VMs with admin privileges

Create snapshots of your VMs

When up-scaling, Azure will deploy your app on top of your custom VM image

SQL Azure:

Only pay for what you use

Do not worry about disaster recovery

Change a connection string an have effortless switch to SQL Azure

Sync framework to sync SQL DBs in the cloud with on-premise data

Service Bus:

Securely connect apps (on-premise with cloud)

Tunneling technology

Services bus is a middle man for communication between

Access Control:

Provides outsourcing of claims-based RESTful services

Integrates with ADFS v2

Tags: ,


Nov 18 2009

PDC Day 1 KeyNote Notes

Category: ASP.NET, SharePoint, Silverlight, Technology, WCF, WF, WPF, WinFormsAdam Toth @ 8:53 am

    Windows Azure Improvements since last year:

  1. Support PHP, CGI, Apache, other frameworks
  2. Expose very low-level programming efforts (not just .NET).
    Example was a C++ app with pointers exposed as an Azure service
  3. Identity framework (support passing tokens from federated locations i.e. onsite AD instance)

    SQL Azure Improvements since last year:

  1. Not just RESTful consumption of services anymore
  2. Works with standard TDS based tools (SQL management studio)

    Microsoft has a vision of "Three screens and a Cloud".

    The screens include:

  1. Mobile devices
  2. Desktop computers
  3. Internet connected TVs

    They can all be united by data and services in the cloud.

Public Data in the Cloud (Codename "Dallas").

Repository for public data sets that can be consumed in any number of ways (and easily by Azure)

Accessed through Microsoft PinPoint

Sign up for a CTP key

Some data includes NASA mars photos, GIS data, AP News articles

PinPoint:

Centralized marketplace for partner providers, Azure ISVs and implementers, and gateway to "Dallas" public Data.

"System Center" will plugin to Azure to monitor your Azure instances, check to meet SLAs, and enable you to scale up the Azure instances directly.

2010 will include ability to have the Azure cloud be able to establish a network connection to on-premise resources (i.e. self hosted SQL Server)

WordPress is moving to Windows Azure

Tags: , , ,


Mar 06 2009

Helper Method for ASP.NET Wizard Controls

Category: ASP.NET, TechnologyAdam Toth @ 11:38 am

I enjoy working with the ASP.NET Wizard control – it’s one of the more useful controls available, and there always seems to be a place for a wizard in the custom apps I’ve written. Over time I’ve developed a helper method that makes it easier to do non-linear jumps from step to step.

GetIndexFromStep(WizardStepBase step)

Often, in a NextButtonClick event handler for a Wizard, you need to figure out what the current step is that you are on, based on the WizardNavigationEventArgs e.CurrentStepIndex property. Here is a helper method to enable you to do that:

/// <summary>
/// Returns the index of a particular wizard step in the WizardSteps collection
/// </summary>
/// <param name="step">The step whose index number you want</param>
/// <returns></returns>
private int GetIndexFromStep(WizardStepBase step)
{
    return step.Wizard.WizardSteps.IndexOf(step);
}

You can also package it up as an extension method (.NET 3.5) off of the Wizard or WizardStepBase object:

using System.Web.UI.WebControls;
 
/// <summary>
/// Extensions for ASP.NET Wizard Control Objects
/// </summary>
public static class WizardExtensions
{
    
    /// <summary>
    /// Gets the index of a particular wizard step.
    /// </summary>
    /// <param name="wizard">The current Wizard</param>
    /// <param name="step">The step whose index number you want</param>
    /// <returns></returns>
    public static int GetIndexFromStep(this Wizard wizard, WizardStepBase step)
    {
        return wizard.WizardSteps.IndexOf(step);
    }
    /// <summary>
    /// Gets the index of this wizard step.
    /// </summary>
    /// <param name="step">This step</param>
    /// <returns></returns>
    public static int GetIndex(this WizardStepBase step)
    {
        return step.Wizard.WizardSteps.IndexOf(step);
    }
}

If you’ve given your wizard steps specific IDs, then you can use them strongly typed in a NextButtonClick event:

protected void Wizard1_NextButtonClick(object sender, WizardNavigationEventArgs e)
{
    if (e.CurrentStepIndex == GetIndexFromStep(step1))
    {
        // We are on step #1
 
        // Validate...
 
        // Skip to step 3
        Wizard1.ActiveStepIndex = GetIndexFromStep(step3);
 
    }
}

Tags: ,


Oct 03 2007

Apostrophes in Community Server

Category: ASP.NET, TechnologyAdam Toth @ 11:15 pm

I noticed that the RSS feed for this blog had a screwed up blog title because of the apostrophe in it. It seems that community server is htmlencoding the blog title, and that is getting passed through to the RSS feed as “& # 3 9 ;”. This was supposed to be fixed in a service pack, but doesn’t seem to have made it in yet on this particular blog.
In the meantime, I found a workaround. Open your Windows Character Map, and choose the following character:

Select it, copy it, and paste it into the text box for your blog title. It’s a good substitute, and doesn’t get encoded. I’m not sure if the same problem exists for post titles, so this workaround may be applicable to those as well.

UPDATE: I’ve now moved on and am using a WordPress blog.

Tags: