06 August 2007

How do I? – Work around the BUG where Site Columns for a custom Site Content Type do not show up as field controls in SharePoint Designer when customizing the Page Layout


OK, a very long description for a problem that I ran into when adding new Page Layouts for Custom Content Types via the SharePoint UI. The problem is that Site Columns do not become available for you when you try to customize the Page Layout with SharePoint Designer, if it was added via the UI. Here's the steps to recreate and work around the issue:
  1. Create a new Site Column.
  2. Create a new Site Content Type.
  3. Make the new Content Type available.
  4. Create the new Page Layout for the new Site Content Type.
    1. Navigate to SA/SS/MASS.

    2. Under the Galleries section, click the "Master pages and page layouts" link.

    3. Drop down the New menu in the menu bar.
    4. Click the "Page Layout" option on the popup menu.

    5. The Content Type Group should default to "Page Layout Content Types". If it does not, set it to this value as we created the new Content Type as a child of Page Layouts.
    6. Drop down the Content Type Name and select your new Content Type, in our example it is "TestContentType".
    7. In the URL Name field, enter the URL you wish to use for the Page Layout.
    8. In the Title field, enter the Title you wish to use for the Page Layout.

    9. Click the "OK" button to add the new Page Layout.
    10. The new Page Layout should now show up in the list.

  5. Edit the new Page Layout in SharePoint Designer.
    1. Open SPD and open your portal.
    2. In the Folder List, expand the web site item.
    3. Expand the "_catalogs" item.
    4. Expand the "masterpage" item.

    5. Locate your new Page Layout file. It should already be checked out since we just created it and SharePoint by default would create the new file in checked out mode. You can tell that it's checked out by the green check mark () before the file name.

    6. We now want to add some Site Columns to our new Page Layout. If you look at the code view window of the Page Layout, we'd want to add these fields inside the "PlaceHolderMain" content tag between lines 6 and 7.
    7. After positioning the curser at the beginning of line 6, we want to add a Content Field.
    8. In the Toolbox toolbar/pane, scroll all the way down to the bottom of the list and locate the Content Fields section.
    9. BUG: We do not get any fields that we can add in this section. Instead, we get an error message stating "An error occurred while downloading the Toolbox information."

    10. If you click the "Refresh" link, you are just presented with an error dialog window stating "The server could not complete your request. Contact your Internet service provider or Web server administrator to make sure that the server has the FrontPage Server Extensions or SharePoint Services installed."

    11. At this point you're thinking that just maybe you need to publish the new Page Layout before it becomes available.
    12. So we right click the Page Layout file in the Folder List and click "Check In" in the drop down menu.

    13. We then select the "Publish a major version" option and click "OK" to publish the new Page Layout.

    14. You'll now be presented with an error message stating "Cannot perform this operation. The file is no longer checked out or has been deleted."

    15. Basically, there is no way to get valid Page Fields to be available to this Page Layout because it was added via the UI. In order to work around this BUG, we need to add the Page Layout from SPD Go ahead and delete the Page Layout by right clicking on it and selecting "Delete" on the popup menu.

  6. Add the Page Layout from SharePoint Designer.
    1. If you have not done so ensure that the Page Layout file does not already exists and then open SPD and open your portal.
    2. In the Folder List, expand the web site item.
    3. Expand the "_catalogs" item.
    4. Expand the "masterpage" item.

    5. Right click the "masterpage" folder.
    6. On the popup menu, hover over the "New" option until it expands a second level popup.
    7. On the second level popup menu, click the "SharePoint Content" option.

    8. On the New dialog window, Select the "SharePoint Publishing" option.
    9. In the 2nd column, select the "Page Layout" option, if it is not already selected by default.
    10. Leave the Content Type Group set to "Page Layout Content Types".
    11. Drop down the Content Type Name dropdown list and select your new Content Type, "TestContentType" in our example.
    12. In the URL Name field, enter the URL value you wish to use for this Page Layout. In our example, we're using "TestPageLayout".
    13. In the Title field, enter the Title you wish to use for this Page Layout.

    14. Click the "OK" button to add the Page Layout.
    15. SPD will load a new instance of itself and load the new Page Layout in edit mode for you. If you now look at the Content Fields and Page Fields sections in the Toolbox tool pane, you'll notice that the fields are now available for you to add to you Page Layout.
Later
C

No comments:

Post a Comment

Comments are moderated only for the purpose of keeping pesky spammers at bay.

SharePoint Remote Event Receivers are DEAD!!!

 Well, the time has finally come.  It was evident when Microsoft started pushing everyone to WebHooks, but this FAQ and related announcement...