Learn to integrate Web publishing with working with your Word documents.
The following is Chapter 17 from Building Websites with Microsoft Content Management Server by Lim Mei Ying, Joel Ward, and Stefan Goßner; published by Packt Publishing.
Authoring Connector provides the ability to upload content from Microsoft Word directly to MCMS, allowing authors to continue to work in the familiar Word environment without having to learn the technicalities of HTML or other web scripting languages. Through a simple publishing process, a Word document can be uploaded to the MCMS web server and published as a posting.
You will find Authoring Connector particularly useful when:
- Authors are not comfortable editing content in the browser and would be happier using Word instead.
- Authors require a rich editing environment that allows them to work with complex objects such as tables.
- Templates are structured to contain a single placeholder.
Authoring Connector is a client component and needs to be installed on every desktop that requires it. Once installed, it adds a Send to MCMS option to Word's File menu. Authors click on this option to upload the open document to the website.
In this chapter, we will build an additional section for the TropicalGreen site, named Columns. This new segment serves as an area for authors to upload articles they have written about fellow members, latest events, their gardening experiences, and what they've been growing in their backyards. To test the capabilities of Authoring Connector, we will use it to publish content from Word to the Columns channel.
Before We Begin
In order to complete the rest of the chapter, you must have the following software installed on your computer:
- Word XP or Word 2003
- Authoring Connector, which we will install below.Publishing with Authoring Connector
Installing Authoring Connector
To begin, close all instances of Word on your desktop (remember to save your work first).
Insert the Microsoft Content Management Server 2002 CD into your computer. On the splash screen, choose to Install Authoring Connector. Click Next to get past the Welcome screen.
Note: You could also download the latest version of Authoring Connector from the official Microsoft website (http://www.microsoft.com/downloads) and store the installation file, AuthConn.exe , on a central computer for distribution to authors.
In the Customer Information dialog, enter your name and the name of your company. Choose to either add Authoring Connector options to all profiles on the computer or only to your profile. When you are done, click Next.
Select the Destination folder. The default folder is \Authoring Connector\ under the MCMS installation folder. If the specified folder does not exist, the installer will create it for you. When you have made your selection, click Next.
Enter the MCMS server name. Click Next when you have entered the name of a valid MCMS server, or leave it as localhost.
The next screen displays the name of the MCMS server name entered earlier. You can change the setting by clicking on the Back button. To begin the installation, click Install.
Once you have installed Authoring Connector, open Word and select File from the menu bar. You should see a new entry Send to MCMS, which expands to reveal more options.
- Create New Page
- Update Same Page
- Replace Any Page
The Update Same Page option is not available at the moment because you have not published the page to MCMS.
In addition, a new entry, MCMS Authoring Connector Help is added to the Help menu. The link leads to the Authoring Connector help file, which guides authors through a step-by-step tutorial on how to use Authoring Connector to publish Word documents to MCMS.
Note: If the Send to MCMS menu item is missing or grayed out, it means that Authoring Connector was not registered properly on the client. Run the installation process again, this time:
- Ensure that all instances of Word on the client machine have been properly closed
- After Authoring Connector has been installed, open Word. Select Tools | Macro | Security. In the Security dialog, click on the Trusted Sources tab. Check that the Trust all installed add-ins and templates option is selected.
We will now create the new section for the TropicalGreen website, named Columns. It will be a place for listing articles about the latest news from TropicalGreen. Authors usually create articles from Word documents. A typical column runs about a page long and may include pictures at appropriate points. Here's what we will be doing:
- We will start by creating a template for our columns.
- Next, we will open an existing Word document and use Authoring Connector to create a new posting based on the template that we have created.
- Then we will use the existing Word document and test the update and replace functions of Authoring Connector.
The final part of the chapter will discuss how certain parts of the publishing process can be automated using Publishing Tasks.
We'll re-use the channel rendering script from Chapter 9 to list all articles available in the channel.
An article created for the columns section appears as shown in the following figure:
Building the Column Template
Before we can publish with Word, we need to build a template to be used by postings created using Authoring Connector. Like regular postings, a template object and template file pair will be created.
Creating the Template Object
Open the TropicalGreen solution in Visual Studio .NET.
First, create the template object. In Template Explorer, add a new template object to the Columns template gallery. Name the new template Column.
Next, in the PlaceholderDefinitions collection, add an OfficeHtmlPlaceholderDefinition and an OfficeAttachmentPlaceholderDefinition with the properties shown in the following table.
|Description||Placeholder containing the story|
||Description||Placeholder containing the story in its original Word document format|
Add a TextCustomPropertyDefinition to the custom property definition collection with the following properties:
|Custom Property Type
||Author's own research|
Creating the Template File
Add a new MCMS template file to the Templates folder of the TropicalGreen project. Name the new template file Columns.aspx. Immediately switch the PageLayout property to FlowLayout.
Toggle back to the MCMS Template Explorer. Set the TemplateFile property of the Column template to point to the Columns.aspx template file. Check in the template object.
In Columns.aspx, switch to HTML view. Between the <head> and </head> tags, link to the stylesheet created in Chapter 7 to the template file.
. . . code continues . . .
<LINK href="/tropicalgreen/Styles/Styles.css" type="text/css"
Between the <form> and </form> tags enter the code below.
<table width="100%" border="0" cellspacing="0" cellpadding="0"
<td width="100%" colspan="2" valign="top" bgcolor="#FFCC00">
<td rowspan="10" valign="top">
(Space for Console)
<td colspan="2">(Space for Top Menu)<td>
(Space for HTML Placeholder Control)
(Space for Attachment Placeholder Control)
<td class="RightMenuBar" width="20%" valign="top" height="100%"
align="center" rowspan="2" bgcolor="#669900">
(Space for Right Menu Bar)
When you have entered the HTML code, switch back to Design view. Drag and drop the following Web User Controls onto the form:
- TopMenu.ascx (built in Chapter 13) into the cell containing the words (Space for Top Menu)
- RightMenu.ascx (built in Chapter 13) into the cell containing the words (Space for Right Menu Bar)
- DefaultConsole.ascx into the cell containing the words (Space for Default Console)
From the Toolbox, drag and drop the following MCMS placeholder controls:
- HTMLPlaceholderControl into the cell containing the words (Space for HTML Placeholder Control). Set the PlaceholderToBind property to Story and the ID to ColumnStory.
- SingleAttachmentPlaceholderControl into the cell containing the words (Space for Attachment Placeholder Control). Set the PlaceholderToBind property to StorySource and the ID to ColumnStorySource.
Delete the text markers after you have dragged the controls onto the form. The completed page is shown in the following figure:
Save and build the TropicalGreen solution.
Finally, use the ChannelRenderingScript.aspx channel rendering script (created in Chapter 9) to display a list of all articles posted to the Columns channel. Open Site Manager and set the Script Url property of the Columns channel to:
The OfficeHtmlPlaceholder and OfficeAttachmentPlaceholder Definitions
In the Column template, we use the two placeholder definitions shipped with MCMS that provide support for authoring from within Word:
- OfficeHtmlPlaceholderDefinition, which has the same properties and methods as the HtmlPlaceholderDefinition
- OfficeAttachmentPlaceholderDefinition, which has the same properties and methods as the AttachmentPlaceholderDefinition
When building templates that work with Authoring Connector, use the Office versions of the placeholder definitions. It is through these specialized placeholder definitions that Authoring Connector differentiates between placeholders that it needs to fill with data and placeholders that it should ignore.
To understand this better, consider the case of a template that has two placeholder definitions: The first placeholder uses the regular HtmlPlaceholderDefinition and the second, an OfficeHtmlPlaceholderDefinition. When content is published from Word using Authoring Connector, only the OfficeHtmlPlaceholder object receives the content. Authoring Connector will ignore the HtmlPlaceholder object if an OfficeHtmlPlaceholder object is available.
If multiple OfficeHtmlPlaceholderDefinitions or OfficeAttachmentPlaceholderDefinitions are added to the same template, all placeholders will receive the same content. For this reason, you can't split the content of a Word document between more than one placeholder. For example, using the standard Authoring Connector functionality, it is not possible to ensure that the title goes into the first placeholder, the abstract fills a second placeholder, and the main body goes into a third placeholder.
Cross reference: The article, Customizing Microsoft Content Management Server 2002 Authoring Connector, found in the MSDN library at the URL http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmscms02/html/mscms_CustAuCo.asp, suggests ways to split a Word document over multiple placeholders.
The following table summarizes how Authoring Connector saves content based on the placeholder definitions found in the template.
|Composition of Template
||Authoring Connector Behavior|
|Contains one OfficeHtmlPlaceholder
||Authoring Connector publishes content to the OfficeHtmlPlaceholder|
|Contains one OfficeAttachmentPlaceholder
||Authoring Connector publishes the document as an attachment to the OfficeAttachmentPlaceholder.|
|Contains one OfficeHtmlPlaceholder and one OfficeAttachmentPlaceholder
||Authoring Connector publishes the content to the OfficeHtmlPlaceholder and the document as an attachment to the OfficeAttachmentPlaceholder.|
|Contains more than one OfficeHtmlPlaceholder
||Authoring Connector publishes content to each OfficeHtmlPlaceholder.|
|Contains more than one OfficeAttachmentPlaceholder
||Authoring Connector publishes the document as an attachment to each OfficeAttachmentPlaceholder.|
|Contains no Office placeholders but contains at least one HtmlPlaceholder
||Authoring Connector publishes content to the first HtmlPlaceholder it finds on the page.|
|Contains no Office placeholders but contains at least one AttachmentPlaceholder
||Authoring Connector publishes content to the first AttachmentPlaceholder it finds on the page.|
|Contains no Office placeholders but contains at least one HtmlPlaceholder and at least one AttachmentPlaceholder
||Authoring Connector publishes content to the first HtmlPlaceholder it finds on the page and saves the original Word document in the first AttachmentPlaceholder.|
|Contains at least one OfficeHtmlPlaceholder and at least one AttachmentPlaceholder/HtmlPlaceholder
||Authoring Connector publishes content to each OfficeHtmlPlaceholder. No AttachmentPlaceholder/HtmlPlaceholder receives any content.|
|Contains at least one OfficeAttachmentPlaceholder and at least one AttachmentPlaceholder/HtmlPlaceholder
||Authoring Connector publishes content to each OfficeAttachmentPlaceholder. No AttachmentPlaceholder/HtmlPlaceholder receives any content.|
Publishing from Microsoft Word
Now that we have a template created, we can proceed to upload a document from Word using Authoring Connector. To begin, open a Word document. You can download the sample document from the code download section of the book's companion site or use one of your own documents. On the menu bar, select File | Send to MCMS | Create New Page. If you have any unsaved changes, Word prompts you to save them before proceeding.
The Authoring Connector Wizard dialog appears as shown in the following figure. Ensure that the Change Server Name and Path option is unchecked. Click Next to get past the welcome screen. If you have set Internet Explorer to prompt for a user name and password in the intranet zone, you will get a prompt to login at this point.
The next screen shows you a list of publishing tasks. We have not defined any so the list is empty for now (see the section Creating Publishing Tasks for a discussion on creating and using publishing tasks). Click Next to continue.
You are prompted to select the destination channel. Select the Columns channel and click Next.
Note: If you are unable to see the channel hierarchy and can only choose the top-level channel, it means that either you do not have subscriber access to any of the second-level channels or the IE Web Controls are not correctly installed on the MCMS server.
The dialog prompts you to select the template. Select the Column template and click Next.
The wizard asks for the page's name, title, and description. Only the page name is mandatory. If you leave the Title to appear on Web page (which is the display name) blank, MCMS assumes that the title should take the same value as the name. Fill up the fields with the following values:
|Title to appear on Web page
||A Walk Through Jenny's Garden|
|Make the title the same as the page name
||You can publish pages directly from Word to MCMS using Authoring Connector!|
When you have completed all fields, click Next.
The next screen requests the start and end dates of the posting. By default, the start date is
set to the current date and time and end date to never (or 1st January 3000). Accept the
Ensure that the Advanced page properties option is checked and click Next.
Because we have chosen to see the advanced page properties in the previous screen, the next screen shows us what these properties are. The first section displays four properties:
- Mark page as special page sets the IsImportant property of the page.
- Allow Web robots to crawl links sets the IsRobotFollowable property of the page.
- Hide page from subscriber when published sets the IsHiddenModePublished property of the page.
- Allow Web robots to index this page sets the IsRobotIndexable property of the page.
The second section displays a list of all custom properties assigned to the template. In this example, we have a custom text property named SourceOfInformation. To edit its stored value:
- Set the Use Default property to False.
- Enter text in the CurrentValue field e.g. (your name)'s research.
When you have set the advanced page properties, click Next.
You have now entered all the necessary information to get the posting published. Click on the Preview Page button to see how the posting will appear when published. The rest of the dialog provides you with a summary of the page's name, title, destination channel, and template. These are read-only text boxes and to change any of these values, you'll need to click the Back button. Click Next to submit the page to the publishing workflow.
|When I click Next at the Page Submission dialog, I get a pop-up dialog with a server 500 error.|
You are probably using the .NET Framework 1.1. .NET 1.1 ships with a new feature that identifies potentially harmful content in POST requests. MCMS requires that this feature be disabled.
To do this, open the folder \Server\MCMS under the MCMS installation folder.
Turn off the read-only property of the web.config file. Then open the
web.config file for editing and add the following line below the
</httpModules> line at the bottom:
<pages smartNavigation="false" validateRequest="false" />
Save and close the web.config file and now you should be able to continue using the Authoring Connector.
A new posting is created in MCMS and the wizard informs you that it has been submitted to the publishing workflow. If editors and moderators have been assigned to the destination channel, the posting will not be published immediately but instead will be set to a Waiting For Editor Approval or Waiting For Moderator Approval state. Editors and moderators have to use Web Author to approve or decline a posting.
Check the Launch MCMS Web Author option and click Finish.
The posting has been created in MCMS and appears as shown in the following figure. Notice that it is in a Published state. That's because we have not assigned any editors or moderators to the Columns channel so any updates from authors are published without any approval required.
The content from the Word document has been saved to the OfficeHtmlPlaceholder. At the bottom of the page you will find a link to the original document that has been saved to the OfficeAttachmentPlaceholder. You may notice a few differences in the way the content is formatted. We will fix this in the Maintaining a Consistent Look and Feel section in this chapter.
Updating the Page
The first time a page is published using Authoring Connector, two properties are created within the Word document. Open the Word document. From the menu bar, select File | Properties and open the Custom tab of the Properties dialog.
You will see two new entries:
- CmsServerUrl contains a string that points to the server-side component, usually in the form http://servername/mcms/cms/officeWizard/oc.aspx
- CmsPostingGuid stores the GUID of the MCMS posting
The CmsServerUrl and CmsPostingGuid property values are used by Authoring Connector when you decide to update the document in your MCMS repository.
To update the document and submit it for publishing, follow these steps:
- With the Word document opened, select File | Send to MCMS | Update Same Page from the menu bar.
- At the Welcome screen, click Next.
- You are immediately brought to the Page Properties dialog. Notice that Authoring Connector skips the Publishing Tasks, Channel Information, and Template Information dialogs. It already has this information from the custom property values of the Word document. In the Page Properties dialog, you can choose to amend the page name, title, and description. The previously saved property values are retrieved from the MCMS repository and displayed here. Click Next.
- In the Publishing Date and Times dialog, you can adjust the publishing start and end dates. Click Next.
- In the Page Submission dialog, click Next to save changes to the content repository.
- After submitting the page, click Finish to close the Authoring Connector dialog.
Authoring Connector relies on the custom property values of the Word document to link back to the posting in the content repository. Should the posting be deleted, you will receive an error message immediately after the Welcome screen.
If the posting is in a state where updates are not allowed (e.g. if another author locks the posting), you will get the message The current user does not have rights to edit the requested item. when attempting to submit the posting.
If you are sure that the posting does exist on the server, choose the File | Send to MCMS | Replace Any Page option instead.
Note: Remember to keep the Word document updated with the latest content. Otherwise, when you next use Authoring Connector to publish the document, it overwrites all changes that were done in Web Author.
Using Authoring Connector is a one-way road: It updates the website but it does not receive updates from the website.
Note: If you don't want your authors to accidentally overwrite changes made using the Web Author Console, you can set up your templates to only allow changes to come from the Authoring Connector and not allow postings to be edited using Web Author. You can do that by disabling the edit button in the Web Author. The technique is discussed in Chapter 19.
Replacing Any Page
The Replace Any Page option allows you to replace any posting in the MCMS content repository with the contents of the Word document.
You will find this option useful when:
- The posting was originally created using the Web Author Console. You have taken advantage of Word's rich authoring environment to update the posting's content and now need to synchronize your work with the online posting.
- Someone unknowingly deletes or amends the CmsServerUrl or CmsPostingGuid property values of the Word document preventing Authoring Connector from 'remembering' the location of the original posting.
To replace an existing posting:
- Select the File | Send to MCMS | Replace Any Page option from the menu bar.
- At the Welcome screen, click Next.
- The next screen prompts you for the posting to replace. Navigate through the tree of channels and postings to select the posting you wish to replace. For example, choose to replace the article created earlier, AWalkThroughJennysGarden. The path of the selected posting is shown in the Web page path field. After you have made your choice, click Next.
- You are shown the Page Properties dialog. As before, you can choose to update the posting's name, title, description, start and end dates, and other properties. Click Next to accept the current values.
- At the Page Submission screen, click Next to submit the posting.
- Click Finish to close the Authoring Connector dialog.
Submitting Selected Text
So far, we have saved entire Word documents as postings. You can also choose to save selected portions of text instead of the complete document. This works only for an OfficeHtmlPlaceholder: an OfficeAttachmentPlaceholder will always receive the entire Word document.
Open the Word document created earlier and highlight a portion of text. From the menu bar, select File | Send to MCMS | Update Same Page.
The Welcome Screen appears with a new option. You can choose to publish:
- The selected content only
- The whole document
To publish only the highlighted text, choose the Selected content only option and follow the rest of the publishing process. However, we want to keep the full text and image in our posting, so click Cancel.
Maintaining a Consistent Look and Feel
Word uses document templates to define the styles for a document. When you first create a Word document, the default template used is the Normal template (normal.dot). You could change the template used in Word by selecting Tools | Templates and Add-Ins from the menu bar. Each document template defines the font family, font size, alignment, color, and other properties that govern the look and feel of the page.
Note: Document templates are files that contain the style definitions for Word documents. Documents that share the same template therefore have the same look and feel.
When Word documents are saved as postings, the look and feel of the document changes to that of the stylesheet attached to the template file. For example, when we published AWalkthroughJennysGarden from a Word document, our level-1 headings appeared in Arial fonts of size 16pt in Word:
However, they display as Verdana font-size 14pt in brown once uploaded on the posting:
Authors often get puzzled over this change in format. They get especially concerned when the change in style causes carefully positioned text and objects in the document to lose their place.
To understand this better, we need to look at what goes on behind the scenes when you publish the document using Authoring Connector. One of the tasks performed by Authoring Connector is to convert the document to a web page. To repeat this operation:
- Open the Word document uploaded in the previous section in Word.
- Select File | Save As Web Page from the menu bar.
- Choose the Web Page, Filtered option in the Save as type drop-down menu.
- The file is saved with a .htm extension.
- Close Word.
Open the generated web page in Visual Studio .NET. Switch to HTML view so that you
can see the source code. At the top of the web page the <style> tags are defined.
The following code shows a snippet of what you may see.
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
font-family:"Times New Roman";}
margin:1.0in 1.25in 1.0in 1.25in;}
Being embedded between <head> tags, <style> tags are not imported to the placeholder when the Word document is uploaded through Authoring Connector. In order to preserve the styles and formatting from the Word document, these additional style tags must be inserted into the template. To add styles from the Word document to the Column template:
- Open the Column.aspx template file.
- Switch to HTML view.
- Copy and paste the contents of the <style></style> tags in the saved web page between the <head> and </head> tags of Column.aspx.
- Save Column.aspx .
With the styles copied over to the template file, the look and feel of the Word document is preserved. Note the conversion from Word to HTML may not always be 100% accurate. Word may not convert complex formatting correctly to HTML. This is a limitation of Word itself. It is a good idea to remind authors to click on the Preview button in Web Author before submitting their work. Best results can often be achieved by saving the Word document as a file of the type Web page,Filtered(*.htm, *.html).
Note: Typically, you would create a document template that shares the same style rules as the template applied on the website. Authors must then be educated to use that document template to create all documents that are to be published using Authoring Connector.
Reducing the Spacing between Line Breaks
When working in Word, you define where one paragraph ends and another begins by pressing the Enter key. This keystroke generates a new paragraph, introducing an extended spacing between one paragraph and the next one.
After being published to MCMS using the Authoring Connector, an extra line appears to have been added wherever the Enter key was pressed, causing the white space between paragraphs to double in size.
This is because hitting Enter creates a new paragraph, which is translated to a <p> tag when the document is converted to a web page. By default the <p> tag is displayed with margins that are approximately the size of two single lines.
There are several ways to get around this.
- The easiest solution is to copy the styles from the Word template document and incorporate it into the stylesheet used by the template file as described above. The Word template document has definitions for the <p> tag to limit the margin between paragraphs.
- You could also define the margins of the <p> tag. For example, you could add in a style that says:
All paragraphs would automatically have their top margins reduced to only 10px, or approximately the height of a single line. Note that if you do so, all other page design elements that use the <p> tag will be affected by this setting.
Another option is to get authors to press Shift + Enter instead of just Enter. This introduces a line break, which gets translated to a <br> tag that has a smaller margin.
The best solution is to create your own custom Word document template that makes paragraphs show up with the margin that you want and export the styles used to the template file. That way, authors see the same formatting applied on both the Word document and the posting.
Changing the Server Name
You may have authors publishing Word documents to several MCMS sites hosted on different servers. Or perhaps the server that hosted the website has changed location and the address needs to be updated. Whatever your reasons may be, you need to point Authoring Connector to a server that was different from the one defined during the installation sequence.
The good news is that you can easily do that from Authoring Connector itself.
- Open your Word document.
- From the File | Send to MCMS menu, select either the Create New Page or Replace Any Page option.
- In the Welcome screen, select the Change server name and path option.
- Click Next and you will see the Default MCMS Server dialog as shown below. In the Server name and path field, enter the address of the oc.aspx file on the target MCMS server.
- Click Next to save the setting or Reset to restore the previously saved settings.
Note: If the server name and path point to a MCMS server that is not available or if the path is not correct, you get a "requested resource not found" error message when trying to proceed from the Welcome screen to the next dialog.
Changing the Server Name for Hundreds of Documents
You may have created hundreds of documents and published them using Authoring Connector. And for reasons beyond your control, it has been decided that the server that hosts the MCMS website is to change its name. It would be a time consuming task indeed to open each document to change its server name and path.
Fortunately, you can change the name of the server using scripts. Simply update the CmsServerUrl property of the Word document. A way to achieve this could be to create a console application that references the Microsoft Word 10.0 Object Library COM object (for Word 2002/XP) or Microsoft Word 11.0 Object Library COM object (for Word 2003) or use Visual Basic for Applications (VBA). Program the script to open each document and set its custom property values appropriately.
Note: Always test any such scripts again after applying any patches or updates from Microsoft.
Creating Publishing Tasks
Some tasks are repetitive. For instance, when authors publish columns, they need to use the Column template and choose Columns as the destination channel. The number of steps required to get the posting published from the moment the document is saved is approximately eight (one for each dialog). Authors have to remember which channels to post to or which templates to use each time they create new postings.
If they were to accidentally select a different channel, the posting would get published to the wrong place. Likewise, should they unwittingly choose another template, the format of the posting would be different from the rest. Human error will occur at some point and when that happens, someone will be called in to clean up the mess.
You can automate the process of publishing documents with Authoring Connector using Publishing Tasks. As the developer, you can specify, on behalf of authors, the destination channel and template to use within each Publishing Task.
The list of Publishing Tasks is stored as an XML file that can be found at \Server\IIS_CMS\OfficeWizard\PublishingTasks.xml under the MCMS installation folder. The following code snippet shows what a single task looks like.
<?xml version="1.0" ?>
<!-- xmlns="http://www.microsoft.com/cmserver/ACSchema" > -->
<name>New Job Posting</name>
<description>New Job Posting</description>
<template>/Templates/General Use/Job Posting</template>
Each task is made up of four elements:
- The name of the Publishing Task must be less than 132 characters. All text must be properly escaped HTML (e.g. < should be represented as <).
- The description of the Publishing Task must be less than 1024 bytes or 1024 ASCII characters. As for the name element, all text must be properly escaped HTML.
- The template or templateGuid is the template on which the new posting is based. You can choose to define the template from its path (e.g. /Templates/TemplateName) or use its GUID.
- channel or channelGuid is the destination channel of the created posting. You can choose to define the channel from its path (e.g. /Channels/ChannelName) or use its GUID.
Let's create a publishing task to automate the process of publishing articles to the Columns channel. Start by opening PublishingTasks.xml in an XML editing tool like Visual Studio .NET or Notepad. Between the <tasks> and </tasks> tags, add a new <task> element as shown below. When you have finished entering the task, save PublishingTasks.xml.
<name>Create a new Column</name>
This task creates a new Column in the Columns section for
the TropicalGreen site
Open a new Word document. Select File | Send to MCMS | Create New Page. Click Next at the Welcome screen.
The next screen displayed is the Publishing Task dialog. The task that we have created in the PublishingTasks.xml file is listed. The list only shows tasks in which the author has rights to both the template and the channel. Select Create a new Column. The description of the task is shown in the bottom panel. Click Next.
Authors can continue to manually select the template and destination channel by checking the Manual entry of channel and template option.
The subsequent screens take you through the rest of the publishing process. Notice that you were not asked to select the template and destination channel: This information was specified in the publishing task.
Using Publishing Tasks simplifies work, shaving off at least two steps from the publishing process. Authors need not even understand the concept of channels and templates. They simply select the task, set the page properties and submit the page for publishing.
Note: If the new publishing task does not show up in the wizard or if the task list remains completely empty, check the following:
Ensure that the template or channel defined exists and that the author has the rights to access these objects.
Check that PublishingTasks.xml contains valid XML with all tags properly opened and closed and that all characters are valid.
Make certain that you are amending the copy of PublishingTasks.xml that is specified in the web.config file of the Authoring Connector (discussed below).
Modifying the Location of PublishingTasks.xml andPublishingTasks.xsd
For security reasons, you may wish to change the location of the PublishingTasks.xml and PublishingTasks.xsd files. To do so, open the web.config file located within the \Server\IIS_CMS\OfficeWizard\ folder under the MCMS installation folder. Look for the following lines of code:
<add key="Publishing Tasks XML File Path"
<add key="Publishing Tasks Schema File Path"
Move this code out of the comment area (<!-- -->) and replace the paths with the new location of the PublishingTasks.xml and PublishingTasks.xsd files. Don't change the value of the key attribute. It must be entered exactly as shown otherwise the new locations of the files would not be recognized.
In this chapter, we have seen how authors can publish content from Word directly to an MCMS site using Authoring Connector. Allowing your authors to continue using the tool they are already familiar with increases their acceptance of the product as well as lowering their learning curve and cranking up their productivity.
We started by creating a template for a new section of the site, which we called Columns. Next, we discussed how Authoring Connector decides which placeholder to fill in when it updates a posting. We were then ready to convert an existing Word document to a posting, using Authoring Connector. We went on to show how easily updates and replacements can be accomplished.
We also saw how formatting can be preserved by transferring the styles used in the Word document over to the template file.
Finally, we looked at how Authoring Connector can be automated and customized using Publishing Tasks. Destination channels and templates can be predefined to prevent authors from posting articles using incorrect templates or channels and to reduce the number of steps required to publish an article.