SharePoint User Group UK

Share the knowledge!

Welcome to SharePoint User Group UK Sign in | Join | Help
in
Home Blogs Forums Photos Files Roller

Programmatically copying Pages from a Publishing site to a sub-site?

Last post 02-09-2010, 7:57 AM by elizas. 2 replies.
Sort Posts: Previous Next
  •  01-26-2010, 12:17 PM 22423

    Programmatically copying Pages from a Publishing site to a sub-site?

    I have a requirement to copy pages from a parent site’s Pages library to the pages libraries of all direct sub-sites. This is to happen when the parent site publishes the page, and to overwrite pages in the destination libraries and publish the pages.

    Does anyone have experience of this? I was thinking of using an event receiver and SPListItem.CopyTo? Is this even possible with Publishing pages?

    Any help appreciated.
    Lee Stevens
    (e) lstevens@collabr8.net
    (w) www.collabr8.net
    (T) 07969 789188

  •  01-26-2010, 3:59 PM 22433 in reply to 22423

    Re: Programmatically copying Pages from a Publishing site to a sub-site?

    Hi ya Lee :), it is certainly possible to move files between sites, take a look at this codeplex project (http://www.codeplex.com/SPDActivities), there is a section called "Copy List Item Extended Activity" this will have some good examples of the code required. I think the hardest part will be the actioning it when a page is published, may need to mess with the event recivers a bit or a timerjob maybe.

    Hope that helps mate

    Andrew Carter
    .Net & SharePoint Consultant

    See my blog at: http://blog.apc-solutions.co.uk
  •  02-09-2010, 7:57 AM 22605 in reply to 22423

    Re: Programmatically copying Pages from a Publishing site to a sub-site?

    By turning on publishing feature you can use Web Content Management(WCM) feature in the site.Once the WCM feature is enabled you can then brand the site with your custom look and feel and can also enable the multilingual support in the site. The multilingual feature helps in creating different folder-based sites according to the languages set to the site.

    While creating a site collection or site & workspaces using SharePoint API , you can add these two lines code to enable the publishing feature.Provided below is an example using C# for enabling publishing feature at site collection level.

    http://bit.ly/b58SlJ
    Cheers,
    Eliza
View as RSS news feed in XML
Powered by Community Server, by Telligent Systems