This article describes a way to share content from the Microsoft Content Management Server 2002 (MCMS) placeholders in an existing posting. The article applies to a scenario when you must share some content from an existing posting of MCMS and reuse the content in a different template. By using the methods that this article discusses, you can create a connected page by using the MCMS Web Browser Client (WBC). You can also create a connected page by using the MCMS Publishing API (PAPI).
When you want to share part of the MCMS content from an existing posting and use it in other postings, you can create a connected page by using a connected template in the MCMS WBC or in the MCMS PAPI. This article describes how to do this without creating duplicate content in a MCMS posting.
You must create a connected template and then create a connected page.
To create a new posting that connects to an existing MCMS page, you must have editing rights to the existing posting. Additionally, you must have rights to create a new posting to the specified channel.
Create a connected template
- Start Microsoft Visual Studio .NET, and then open an existing MCMS ASP.NET Web project solution.
- In Solution Explorer, create a new MCMS template file.
- On the View menu, click Other Windows, and then click MCMS Template Explorer. The MCMS Template Explorer window opens.
- Select a template gallery item (TGI) that contains content that you want to share. Right-click the selected TGI, and then click Create Connected. A connected template gallery item (TGI) is created.
- Right-click the new TGI, and then click Properties. Click Open Template File.
- In the Properties dialog box for the TGI, click the button next to the PlaceholdDefinitions property. The Placeholder Definition Collection Editor dialog box appears. Notice that all Placeholder definition collection items in the new TGI are defined from the source template in step 4.
- Add some PlaceholderDefinitions items in the new TGI, and then click OK.
- In the Properties dialog box for the TGI, click the button next to the TemplateFile property. The Select File dialog box appears.
- Locate and then click the new MCMS ASPX template file that you created in step 2. Click Select.
- Add MCMS Placeholder controls to the new template Web form that you created in step 3. These controls are located under Content Management Server in the Toolbox.
- Select one or more MCMS Placeholder controls that you want to use to get the content from the source template that you opened in step 5.
Note In the Placeholder control Properties dialog boxes, make sure that you use the same PlaceholderDefinitions item for the Placeholder ToBind property that is defined in the Placeholder control in the source template.
- Bind the Placeholder controls that do not have to share the content from the source template in the step 5 to the PlaceholderDefinitions item that is defined in step 7.
- Check in the source TGI and the connected TGI, and then compile the MCMS ASP.NET Web project.
Create a connected page by using the MCMS WBC
After you complete the steps in the "Create a connected template" section, you can use the MCMS WBC to create a connected page. To do this, follow these steps:
- In MCMS WBC Internet Explorer, log on to an MCMS Web site that permits authoring. Verify that you have the correct user rights to create a new MCMS posting.
- Locate the channel that you will use as the basis for the connected page, and then click Switch to Edit Site.
- In the MCMS WBC console, click Create Connected Page. The Template Galleries window opens.
- In the Template Galleries window, locate the channel where you want to publish the connected page. Select the connected template. Notice that the content that you want to share appears in the Placeholder controls that use the same PlaceholderDefinitions items in the source Placeholder controls.
- Because the page name is defined as the name that the source posting uses, you can provide only a display name for a connected page. If you want to provide a display name, type it in the Display Name box. Click OK to save the new posting.
- In the MCMS WBC, click Submit.
- In the MCMS WBC console, click Approve.
Create a connected page by using the MCMS PAPI
You can also use the MCMS PAPI to create a connected page. The following sample code does this for a console application that is written in Microsoft Visual C# .NET. Note
This sample code is intended for demonstration purposes only.
CmsApplicationContext CmsCnPosting = new CmsApplicationContext();
Posting sourcePosting = (Posting) CmsCnPosting.Searches.GetByPath(strSourcePostingPath);
Channel targetChannel = (Channel)CmsCnPosting.Searches.GetByPath(strTargetChannelPath);
Template connectedTemplate = (Template)CmsCnPosting.Searches.GetByPath(strConnectedTemplatePath);
if(sourcePosting !=null && targetChannel !=null && connectedTemplate !=null)
bool pPosting = sourcePosting.CanSetProperties;
bool cT1 = targetChannel.CanCreatePostings;
if(pPosting && cT1)
Posting pNewPosting = (Posting) targetChannel.CreateConnectedPosting(connectedTemplate, sourcePosting);
pNewPosting.DisplayName = strNewPostingName;
MessageBox.Show(this,"A connected posting has been created successfully","Success");
MessageBox.Show(this,"You do not have rights to change posting properties or create a posting","Connected Posting");
MessageBox.Show(ex.Message + " " + ex.Source, "Error creating a connected posting");
For more information, see the MCMS product documentation. The documentation includes information about issues that you may want to consider when you create connected pages.
When the current user updates a posting through any property or through any method, the posting and all its connected postings become owned by that user. This behavior prevents other authors from updating the posting or its connected postings at the same time.
If a user tries to create a connected posting by using a template that causes the number of distinct templates to be greater than 15, the connected posting is not created, and the user receives an error message.
You cannot create connected postings for historical revisions of a channel.
Article ID: 840148 - Last Review: July 19, 2004 - Revision: 1.1
- Microsoft Content Management Server 2002
|kbhowtomaster kbsample kbhowto KB840148|