Share via


How to: Add Tasks and Categories to the Launchpad

 

Applies To: Windows Server 2012 Essentials, Windows Home Server 2011, Windows Storage Server 2008 R2 Essentials, Windows Small Business Server 2011 Essentials

In this section, you create a .launchpad file that contains the XML elements and attributes that represent a Launchpad add-in. The .launchpad file can be installed directly on the client computer or it can be embedded in a resource-only DLL file for localization purposes. The following table lists the XML elements that can be used to define tasks and categories on the Launchpad.

Element Description
LaunchPad The tasks and categories are always defined within a LaunchPad element.
Category Provides a button on the Launchpad that can contain any number of other categories and tasks. The following attributes are used with a Category element:

- id – Provides a unique identifier for the category. It is recommended that you either use a GUID or a namespace-like string of the form <CompanyName>.<AppName>.<FeatureName>.
- name – Provides a caption for the category button. You can assign a hotkey for the button by using the underscore ('_') character as a prefix to the letter that you want to use as the hotkey.
Task Provides a button on the Launchpad that is used to access Web pages or applications. The following attributes are used with a Task element:

- id – Provides a unique identifier for the task. It is recommended that you either use a GUID or a namespace-like string of the form <CompanyName>.<AppName>.<FeatureName>.
- name – Provides a caption for the task button. You can assign a hotkey for the button by using the underscore ('_') character as a prefix to the letter that you want to use as the hotkey.
- src – Indicates how to run a task. The value of this attribute can be either a URL or a command to run an application. Environment variables are expanded when using the src attribute.
- args - Provides optional arguments to the command that is specified in the src attribute. A list of arguments is specified as a single string.
- image – Specifies the name of the image resource that is displayed for the task or category. This attribute only applies if you are using data that is embedded in a resource-only DLL file. It is recommended that a transparent .png file is used for optimum effect.
- iconPath – Specifies the path of the icon or image file. The path can be an absolute path or relative path. If a relative path is used, it must be relative to %Programfiles%\Windows Server\Bin\Launchpad. Environment variables are supported in both the relative and the absolute paths. The file types of .ico, .png, and .jpg are supported, but it is recommended that a transparent .png file is used that is 32x32.
- applyTo - Specifies the groups for which this task is displayed. The value for this attribute can be a comma separated list of group names.

Decide the layout of your add-in

You should take some time to think about the layout of your categories and tasks. The tasks can be either Web pages or applications that are located on the local computer. The following code example shows how to define several tasks that are arranged within several categories:

  
<LaunchPad xmlns=”https://schemas.microsoft.com/WindowsServerSolutions/2010/01/Launchpad”>  
   <!-- Search -->  
   <Task id="MyCompany.Tasks.Search" name="Search the Internet" src="https://www.bing.com/"/>  
  
   <!-- Edit Registry -->   
   <Task id="MyCompany.Tasks.Regedit" name="Edit the registry" src="%SystemRoot%\regedit.exe"/>  
  
   <Category id="MyCompany.Categories.Sample" name="Sample Tasks">  
      <Task id="MyCompany.Tasks.Notepad" name="Notepad" src="%SystemRoot%\notepad.exe"/>  
      <Task id="MyCompany.Tasks.Msconfig" name="MS Config" src="%SystemRoot%\system32\msconfig.exe"/>  
  
      <Category id="MyCompany.Categories.More" name="More Tasks">  
         <Task id="MyCompany.Tasks.Home" name="Home Page" src="https://www.microsoft.com/"/>  
      </Category>  
   </Category>  
</LaunchPad>  

Create the Launchpad add-in file

In this section, you use Visual Studio 2010 to create a new project, and then add your XML code to the project.

To define the LaunchPad element

  1. Open Visual Studio 2010 as an administrator by right-clicking the program in the Start menu and selecting Run as administrator.

  2. Click File, click New, and then click Project.

  3. In the Project types pane, click Visual C#.

  4. In the Templates pane, click Class Library.

  5. Type LaunchPadAddIn in the Name box, and then click OK.

  6. In Solution Explorer, right-click Class1.cs, and then click Delete. You do not need this class for the Launchpad add-in.

  7. Right-click LaunchPadAddIn, click Add, and then click New Item.

  8. In the Templates pane, click XML File, type Content.launchpad in the Name box, and then click Add. You must use the .launchpad extension to include the file in the resource-only DLL file.

    Note

    In this example, the file is named Content.launchpad, but you can provide any name with the .launchpad extension.

  9. Open the Content.launchpad file.

  10. Add the following code to the file to define the LaunchPad element:

    <LaunchPad>  
    </LaunchPad>  
    

To define a Task element

  1. A Task element is a child element of the LaunchPad element. The Task element can be defined by a URL for a Web page or a command for an application. The following code example is added to the LaunchPad element and shows how to define a task that accesses a Web page:

    <Task id="MyCompany.Tasks.Search" name="Search the Internet" src="http://www.adventureworks.com/"/>  
    
  2. The Task element can also be defined by a command that can be used to run an application. The following example shows how to define a task that starts Notepad:

    <Task id="MyCompany.Tasks.Notepad" name="Notepad" src="%SystemRoot%\notepad.exe"/>  
    
  3. (Optional) You can specify that the task is only applicable to members of a specific group. The following example shows how to define a task that starts Notepad for user accounts that are a member of group “A”:

    <Task id="MyCompany.Tasks.Notepad" name="Notepad" applyTo="A" src="%SystemRoot\notepad.exe"/>  
    

    You can make the task available to multiple groups by adding additional group identifiers separated by commas:

    <Task id="MyCompany.Tasks.Notepad" name="Notepad" applyTo="A,B" src="%SystemRoot\notepad.exe"/>  
    

    The task is displayed for the user account if it is a member of any of the specified groups. If the applyTo attribute is not included in a task definition, the task applies to all user accounts. Groups are defined on the server, not the client computer.

To define a Category element

  1. A Category element is a child element of the LaunchPad element. You use the Category element to organize Task elements on the Launchpad. The following code example is added to the LaunchPad element and shows how to define a category of tasks on the Launchpad:

    <Category id="MyCompany.Categories.Sample" name="Sample Tasks">  
    </Category>  
    
  2. You can provide layers of categories. The following code example shows how to provide two layers of categories:

    <Category id="MyCompany.Categories.Sample" name="Sample Tasks">  
       <Task id="MyCompany.Tasks.Notepad" name="Notepad" src="%SystemRoot%\notepad.exe"/>  
       <Category id="MyCompany.Categories.More" name="More Tasks">  
          <Task id="MyCompany.Tasks.Home" name="Home Page" src="http://www.adventureworks.com/"/>  
       </Category>  
    </Category>  
    

    Categories are only displayed when there are tasks available to the user account. If all of the tasks in a category are not applicable to the user account, the category is not displayed.

  3. Save the Content.launchpad file.

Add a resource file

If you choose to localize your Launchpad add-in, you must create a resource-only DLL file and the .dll file must include a .resx file. You use a resource file to specify values for identifiers that are used in element attributes. For example, you can define the name attribute to be “SearchText” and then in the resource file you can specify the value of “SearchText.” You can use this file to localize the text of your add-in.

To add a resource file

  1. In Solution Explorer, right-click LaunchPadAddIn, click Add, and then click New Item.

  2. In the Templates pane, click Resource File, type Launchpad.resx in the Name box, and then click Add. You must name the file Launchpad.resx.

  3. Add the names and values of the text string in the resource file. For example, the following definition exists in the Content.launchpad file:

    <Task id="MyCompany.Tasks.Search" name="Search the Internet" src="https://www.bing.com/"/>  
    

    You can change the value of the name attribute to “SearchText” and then you can add the SearchText string with the “Search the Internet” value in the resource file.

    <Task id="MyCompany.Tasks.Search" name="SearchText" src="https://www.bing.com/"/>  
    
  4. Save the Launchpad.resx file.

Build the embedded resource file

By building the Launchpad add-in file as an embedded resource file, your add-in can be localized and you can control access to the XML code that defines the functionality of the add-in.

To build the embedded resource file

  1. In Solution Explorer, click Content.launchpad.

  2. In the Properties pane, select Embedded Resource for the Build Action.

  3. On the Build menu, click Build Solution.