locked
PublishingWeb.SetAvailablePageLayouts - the flag doesn't seem to do anything RRS feed

  • Question

  • I have a content type, page layout, and can deploy it to my site via a feature.

    I am using PublishingWeb.SetAvailablePageLayouts.  There is a flag resetAllSubsitesToInherit which doesn't do anything.  I even put this into reflector and decompiled so I could see what was going on.  In reflector, I saw a USL log comment, so I looked for it to see what was going on.  It looks like this tries to reset subsites the site I just created.  Since a new site already inherits, what does this do?

    here is an example:

    PublishingWeb.InheritAvailableWebTemplates() beginning LRO pushdown below web '/me/xxx/www/555/ssss'

     

    Tuesday, February 1, 2011 9:13 PM

All replies

  • Hi Jared,

    Have you read the MSDN page?

    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.publishing.publishingweb.setavailablepagelayouts.aspx

    Is this not the API equivalent of the "Reset all subsites to inherit these preferred subsite template settings" checkbox on the "Page Layout and Site Template Settings" page for publishing sites? (_layouts/AreaTemplateSettings.aspx)

    Hope this helps!


    joel
    Joel's SharePoint Architect Blog
    joelblogs.co.uk
    Want SharePoint Training?
    Tuesday, February 1, 2011 11:59 PM
  • Hey Joel, thanks for responding.

    I have read the documentation and even de-compiled the microsoft dll.  I still do not see what it does or if it works.  I think that it might be a bug and was never implemented.

    Has anyone successfully used this?  Can you tell me how to use this command and how to verify that it did something?  If you google InheritAvailableWebTemplates, there is less than two pages of results.  I don't think this is a very popular function.

     

    Thanks a lot

    Wednesday, February 2, 2011 2:30 PM
  • Hi Jared,

    PublishingWeb.SetAvailablePageLayouts
    =========================================

    PublishingWeb.SetAvailablePageLayouts will limit the availability of pagelayout on the web.

    For example, you have custom page layout, you want to restrict the users to use only your custom layout, then SetAvailablePageLayouts will help you. You can make your custom page layout available for use whenever your users create a new publishing page, other layouts will be not be visible.

    If you want the same behavior in subsites of the web, then use the param“resetAllSubsitesToInherit” of SetAvailablePageLayouts function. As you have a new site already inheriting from parent, “resetAllSubsitesToInherit” will push the changes from parent to the subsite. i.e. Whichever pagelayouts are available in parent site are made available to the current site .


    PublishingWeb.InheritAvailableWebTemplates()
    ==========================================
    PublishingWeb.InheritAvailableWebTemplates() – will inherit the web templates from the parent sitecollection.

    You can test it by changing the “Page Layout and Site Template” Settings to option other than “Subsites inherit site templates from parent site”, and then run the code PublishingWeb.InheritAvailableWebTemplates() to inherit web templates from parent site. You can see the templates getting inherited from parent site collection.


    Let me know if this helps

     


    AnjaliCH-MSFT
    Saturday, April 23, 2011 2:32 AM