How to share MCMS content from a connected template in MCMS 2002

This article has been archived. It is offered "as is" and will no longer be updated.
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

  1. Start Microsoft Visual Studio .NET, and then open an existing MCMS ASP.NET Web project solution.
  2. In Solution Explorer, create a new MCMS template file.
  3. On the View menu, click Other Windows, and then click MCMS Template Explorer. The MCMS Template Explorer window opens.
  4. 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.
  5. Right-click the new TGI, and then click Properties. Click Open Template File.
  6. 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.
  7. Add some PlaceholderDefinitions items in the new TGI, and then click OK.
  8. In the Properties dialog box for the TGI, click the button next to the TemplateFile property. The Select File dialog box appears.
  9. Locate and then click the new MCMS ASPX template file that you created in step 2. Click Select.
  10. 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.
  11. 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.
  12. 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.
  13. 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:
  1. 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.
  2. Locate the channel that you will use as the basis for the connected page, and then click Switch to Edit Site.
  3. In the MCMS WBC console, click Create Connected Page. The Template Galleries window opens.
  4. 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.
  5. 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.
  6. In the MCMS WBC, click Submit.
  7. 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();                  CmsCnPosting.AuthenticateAsCurrentUser(PublishingMode.Update);				  try	{				        	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;						                       CmsCnPosting.CommitAll();						                      	MessageBox.Show(this,"A connected posting has been created successfully","Success");					                }			          }				            else				        	{				                      MessageBox.Show(this,"You do not have rights to change posting properties or create a posting","Connected Posting");				                      	return;				          }	}		  catch(Exception ex)	{			       MessageBox.Show(ex.Message + "  " + ex.Source, "Error creating a connected posting");		}			  CmsCnPosting.Dispose();

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.

Connected Posting and Connected Template

Article ID: 840148 - Last Review: 01/10/2015 15:27:58 - Revision: 1.1

  • Microsoft Content Management Server 2002
  • kbnosurvey kbarchive kbhowtomaster kbsample kbhowto KB840148