ENTERPRISE

Microsoft Content Management Server : Building SharePoint Web Parts - The SharePoint MCMS Navigation Control, Creating the Web Part Project

8/30/2012 3:13:28 AM

The SharePoint MCMS Navigation Control

We will develop a Web Part as a server control by building a Web Part that acts as an MCMS navigation component. The server control methodology has been selected as it is the most flexible method. End users with WSS/SPS Web Designer rights will be able to add the Web Part to a Web Part Page and configure the Web Part by specifying the MCMS Channel. The items in the configured MCMS Channel will be rendered in the Web Part using an XSLT (Extensible Stylesheet Language Transformations) stylesheet to produce the following display:

To build this Web Part, we’ll perform the following steps:

  • Prepare the development environment

  • Create the Web Part Project

  • Create the Web Part

  • Define custom properties for the Web Part

  • Develop custom properties for the Web Part

  • Build the Data Layer

  • Build the Presentation Layer

  • Deploy the Web Part

The Web Part we are building will run under both SPS and WSS as we will not be using any features specific to Microsoft SharePoint Portal Server.

Preparing the Development Environment

To most efficiently develop Web Parts as ASP.NET Server Controls, we need to install the Visual Studio .NET templates necessary for Web Parts. These templates don’t ship with Visual Studio .NET 2003, but are available for download from the Microsoft website at:

http://www.microsoft.com/downloads/details.aspx?FamilyID=CAC3E0D2-BEC1-494C-A74E-
75936B88E3B5&displaylang=en

					  

During installation of the Web Part templates, you will be prompted for the location of Microsoft.SharePoint.dll. This assembly is located in Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\ISAPI\ on your SharePoint (WSS/SPS) Server. You might need to copy Microsoft.SharePoint.dll to your development PC from the server with SPS or WSS installed.

Creating the Web Part Project

Web Parts should be built using the Web Part Library project. So let’s go ahead and create this project.

1.
In Visual Studio .NET, select Create New Project (Shift + Ctrl + N).

2.
Select the project type as Visual C# Projects, and choose the new Web Part Library template from the right-hand pane.

3.
Name the new project ExtensibleMCMSPageListingWebPart, and place the project directory under My Documents\Visual Studio Projects.

4.
Click OK.

Once our new project is created, we can see a variety of files and references that have been created by the template:

Some of the most important of these are:

  • References to:

    • Microsoft.SharePoint—SharePoint’s main API

    • System.Web—.NET Framework namespace holding classes for web operations

    • System.Xml—.NET Framework namespace holding classes for XML operations

  • AssemblyInfo.cs—used to define the metadata of the assembly and to specify a key file to sign it.

  • Manifest.xml—used to populate CAB files during the deployment process.

  • WebPart1.cs—an empty Web Part template similar to the Class1.cs file created when using a Class Library template.

  • WebPart1.dwp—an XML file used when deploying Web Parts to Windows SharePoint Services. It contains the references to the assembly name and the class name used by the Web Part.

You can delete the following files from the solution: WebPart1.cs, WebPart1.dwp, and Manifest.xml, as we will create our own later on.

Other  
  •  Active Directory Domain Services 2008 : Search Group Policy Objects
  •  Active Directory Domain Services 2008 : Export a Starter GPO, Import a Starter GPO
  •  The Very Successful Hardware That Microsoft Has Ever Produced
  •  Xen Virtualization - Managing Xen : Virtual Machine Manager
  •  Xen Virtualization - Managing Xen : XenMan—Installing and Running
  •  Dual-Core Or Quad-Core?
  •  IBM WebSphere Process Server 7 and Enterprise Service Bus 7 : Getting Started with WID (part 2) - Working with Modules and Libraries
  •  IBM WebSphere Process Server 7 and Enterprise Service Bus 7 : Getting Started with WID (part 1) - Business Integration perspective
  •  Google vs. Apple vs. Microsoft
  •  DSLs in Boo : Implementing the Scheduling DSL
  •  DSLs in Boo : Combining domain-driven design and DSLs
  •  Active Directory Domain Services 2008 : Restore Group Policy Objects and Starter GPOs
  •  Active Directory Domain Services 2008 : Comment Group Policy Objects and Starter GPOs, View, Print, and Save a Report for Group Policy Objects, Back Up Group Policy Objects and Starter GPOs
  •  Apple Society … Money x Property
  •  Active Directory Domain Services 2008 : Create a New Group Policy Object from a Starter GPO, Edit Group Policy Objects and Starter GPOs, Copy Group Policy Objects and Starter GPOs
  •  Active Directory Domain Services 2008 : Create Group Policy Objects, Delete Group Policy Objects, Create Starter GPOs, Delete Starter GPOs
  •  System Center Configuration Manager 2007 : Architecture Design Planning - Device Management Planning
  •  System Center Configuration Manager 2007 : Architecture Design Planning - Software Update Planning
  •  Programming .NET Components : Marshaling-by-Reference Activation Modes (part 2) - Server-Activated Singleton
  •  Programming .NET Components : Marshaling-by-Reference Activation Modes (part 1) - Server-Activated Single Call
  •  
    Most View
    Simplicity: intuitive design, simple choices, and familiarity
    Buyer’s Guide: Touchscreen Monitors for Windows 8 (Part 3) : Dell S2340T, Elo 2201L
    Refrigerator Is Calling (Part 2)
    The End Of The Beginning Or The Beginning Of The End? (Part 1)
    The Android Army invades! (Part 2) : Wipe out WebOS
    Windows Server 2008 and Windows Vista : Altering Default GPO Processing and Inheritance (part 1) - Block Policy Inheritance, Enforce
    Buying Guide: CPU Cooling Equipment (Part 4) - Thermaltake BigWater 760 Plus,Thermaltake Frio OCK,Zalman CNPS20LQ
    The LTEdge (Part 1)
    Transcend SSD320 128GB – Excellent Mainstream SSD
    IIS 7.0 : Using Command Line Tools - Microsoft.Web.Administration
    Top 10
    G-360 And G-550 Power Supply Devices Review (Part 4)
    G-360 And G-550 Power Supply Devices Review (Part 2)
    Canon IXUS 140 Camera - Great Color Reproduction
    Nikon Coolpix S5200 Camera - 10fps Continuous Shooting Mode
    Corsair Neutron GTX 240GB - A Fast Performing SSD
    G-360 And G-550 Power Supply Devices Review (Part 3)
    G-360 And G-550 Power Supply Devices Review (Part 1)
    OCZ Vector 256GB - One Of The Dominant Names In SSD
    Don’t Pay For Office 2013 (Part 2)
    Don’t Pay For Office 2013 (Part 1)