Click here to Skip to main content
15,881,248 members
Articles / Web Development / HTML
Article

MCMS Placeholder Content Web Part

Rate me:
Please Sign up or sign in to vote.
4.36/5 (5 votes)
22 Jan 2005CPOL4 min read 121.7K   536   31   22
Display content from a Content Management Server placeholder in a WSS site.

Introduction

This web part displays content from a Content Management Server (MCMS) page placeholder in a Windows SharePoint Services (WSS) site or a SharePoint Portal Server (SPS) site. No actual placeholder content is stored in the web part. If the placeholder is updated with new content in the MCMS site, the web part will automatically show the new content in the WSS site.

Background

There are several ways to pull content from MCMS in a WSS site. Off the shelf so to speak, Microsoft provides the free MCMS Connector for SharePoint Technologies. It comes with a MCMS Page Listing web part that displays a summary list of pages in a particular channel. If your requirements are anything more complicated than that, you will need to write your own custom code.

The simplest approach is to use the Page Viewer web part. It displays any web page content in an IFrame. With the entire web page loaded with its own navigation and everything, it does not provide users an UI experience that the content is part of your WSS site.

If the MCMS site is located in the same box as your WSS site, code your heart out with MCMS API in your web part. As this is the exception rather than the norm in a production environment, you may need to resort to Web Service or custom IFrame development to display just the placeholder content, not the entire MCMS page.

MCMS Web Service is indeed a very good approach though you may run into some authentication issues with a web part calling the web service. Windows Integrated Authentication will not work for the web service as far as I know. If you have a SPS site, I would use SPS' Single Sign-On (SSO) service to authenticate.

Using the IFrame route, this web part calls a custom MCMS page which renders the content of a specific placeholder of your choice into an IFrame. The IFrame automatically adjusts its height based on the length of the content so that no scroll bars will show.

Installation

  1. Web Part

    On the WSS server, run SharePoint Services administration tool Stsadm.exe to install package MCMSWebPartsPackage.cab. Alternatively, you can rebuild the package using the source files included. To install the package, run the following command:

    Stsadm.exe -o addwppack -filename c:\MCMSWebPartsPackage.cab

    Modify web.config to mark the web part as safe:

    XML
    <SafeControls>
        .....
        <SafeControl Assembly= "QuestechSystems.MCMSWebParts, 
            Version=1.0.0.0, Culture=neutral, 
            PublicKeyToken=a877c88baf21ba83" 
            Namespace="QuestechSystems.MCMSWebParts" TypeName="*" />
    </SafeControls>

    The "MCMS Placeholder Content" web part should now appear in the Virtual Server Web Part Gallery.

  2. MCMS WssIntegration

    On the MCMS server, copy directory WssIntegration to the root of your MCMS site. Open Visual Studio. Include directory in your MCMS project. Rebuild project.

Usage

Image 1

The "MCMS Placeholder Content" comes with its own custom tool pane with the following properties:

  1. MCMS Site URL - URL to your MCMS site. For example http://woodgrovenet, http://server/woodgrovenet. The server can be a remote server obviously.
  2. Page - This is the posting display path. It will be automatically populated after you select a placeholder using the Select Placeholder dialog.
  3. Placeholder - This is the name of the placeholder. It will be automatically populated after you select a Placeholder using the Select Placeholder dialog.
  4. Select Page & Placeholder - Clicking this button will open a Select Placeholder dialog. This dialog allows you to select a Posting and the Placeholder in it that you want to render the content.

Image 2

You may also want to change the web part title in the Appearance section to fit the placeholder you selected.

Remarks

  1. The web part stores the posting path, posting GUID and placeholder name. It uses the posting GUID and placeholder name to retrieve the placeholder content. If the posting is moved to another channel, the web part will still be able to locate the moved posting and renders the placeholder content. However, the posting path displayed in the custom toolpane will not be correct.
  2. The web part renders the raw content of a placeholder. Placeholders like XmlPlaceholder will not be rendered properly.
  3. The web part will render the unpublished view of the placeholder when you are editing or designing a WSS page.
  4. If you only have one MCMS site to pull content from, you can modify GetSiteUrlDefaultValue() in RenderMCMSPlaceholderTool.cs to always display the specific MCMS Site URL.
  5. All hyperlinks in the rendered placeholder content will open up in the main page, not inside the IFrame.
  6. Scroll bars in the IFrame may appear in non-IE Windows browsers. I only tested it in Windows IE.
  7. If the placeholder content uses custom CSS styles, it will not be rendered in the web part like it does in the MCMS site. In the web.config file of your MCMS site, add the appSettings key SiteCssHrefForWss with the HREF of your site stylesheet. For example, if the MCMS site is the WoodgroveNet site:
    XML
    <add key="QuestechSystems.SiteCssHrefForWss" 
                value="/WoodgroveNet/Style/styles.css" />

History

  • V1.0 - 2004.12.11 - Base.
  • V1.1 - 2005.01.15 - Resolved cross-site security problems when CMS and WSS sites are on different servers.
  • V1.2 - 2005.01.22 - Added option to insert stylesheet reference when rendering placeholder content (see remark 7 above).

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Canada Canada
A Microsoft Certified Professional Developer and Technology Specialist.

Experience and expertise in SharePoint 2016 / 2013 / 2010 / 2007.

Role ranges from a developer in a multi-person team to a solution consultant with expert-level skills, leading a project to completion status.

Proven experience working effectively in a team environment and a self-managed environment.

Comments and Discussions

 
QuestionI can't find the project? Pin
sarama30-Mar-08 18:36
sarama30-Mar-08 18:36 
GeneralHelp Needed | SharePoint Web part and MCMS Pin
Davendra19-May-06 2:47
Davendra19-May-06 2:47 
GeneralRe: Help Needed | SharePoint Web part and MCMS Pin
Stephen Huen19-May-06 7:58
Stephen Huen19-May-06 7:58 
GeneralRe: Help Needed | SharePoint Web part and MCMS Pin
Davendra21-May-06 19:38
Davendra21-May-06 19:38 
QuestionCan this use Forms authentication? Pin
diver726-Jan-06 9:07
diver726-Jan-06 9:07 
GeneralMCMS 2002 and VStudio 2003 does not work Pin
edsanfor237-Jul-05 15:23
edsanfor237-Jul-05 15:23 
GeneralRe: MCMS 2002 and VStudio 2003 does not work Pin
Stephen Huen7-Jul-05 15:55
Stephen Huen7-Jul-05 15:55 
GeneralRe: MCMS 2002 and VStudio 2003 does not work Pin
edsanfor237-Jul-05 16:37
edsanfor237-Jul-05 16:37 
GeneralRe: MCMS 2002 and VStudio 2003 does not work Pin
Stephen Huen7-Jul-05 17:18
Stephen Huen7-Jul-05 17:18 
GeneralHaving problems Pin
milesowen12-Jan-05 15:24
milesowen12-Jan-05 15:24 
GeneralRe: Having problems Pin
Stephen Huen12-Jan-05 16:13
Stephen Huen12-Jan-05 16:13 
GeneralRe: Having problems Pin
milesowen13-Jan-05 3:06
milesowen13-Jan-05 3:06 
GeneralRe: Having problems Pin
Stephen Huen13-Jan-05 19:36
Stephen Huen13-Jan-05 19:36 
GeneralRe: Having problems Pin
Stephen Huen13-Jan-05 19:38
Stephen Huen13-Jan-05 19:38 
GeneralRe: Having problems Pin
milesowen14-Jan-05 1:29
milesowen14-Jan-05 1:29 
GeneralRe: Having problems Pin
Stephen Huen15-Jan-05 15:14
Stephen Huen15-Jan-05 15:14 
GeneralRe: Having problems Pin
milesowen17-Jan-05 5:25
milesowen17-Jan-05 5:25 
GeneralRe: Having problems Pin
milesowen17-Jan-05 10:53
milesowen17-Jan-05 10:53 
GeneralRe: Having problems Pin
Stephen Huen17-Jan-05 15:47
Stephen Huen17-Jan-05 15:47 
GeneralRe: Having problems Pin
Stephen Huen22-Jan-05 12:17
Stephen Huen22-Jan-05 12:17 
Generalthis is good Pin
jkoos2-Jan-05 13:00
jkoos2-Jan-05 13:00 
Generalgreat - thanks Pin
meron18-Dec-04 21:47
meron18-Dec-04 21:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.