Quantcast
Channel: DevNet Questions
Viewing all articles
Browse latest Browse all 8901

Link Page to a Second Site via API

$
0
0
This is a v9.0.51 project. Not possible to upgrade so have to work with what we have.There are @60 sites in the application, with one of them acting as the @master@ site. A lot (but not all) of the content from the master site is linked through to some or all of the other sites, and the other sites can also have their own individual content.It's way too time consuming creating one-off linked pages through to all the relevant sites every time something new is added, so I'm trying to find a way for the site administrator to be able to create linked pages via the api.Using the example from the documentation, I've tried the following, but the @parentPage@ (the parent node on another site which will be the parent of the linked node) is always null. Am I doing something wrong? Or is it not possible to create a linked page on another site?// Creates an instance of the Tree provider TreeProvider tree = new TreeProvider(MembershipContext.AuthenticatedUser); SiteInfoIdentifier secondSite = new SiteInfoIdentifier(@anothersite@); // Gets the page that will be linked TreeNode originalPage = tree.SelectNodes() .Path(@/My-Dashboard/Events/Last-One@) .OnCurrentSite() .Culture(@en-au@) .FirstObject; // Gets the page that will be used as a parent page for the linked page TreeNode parentPage = tree.SelectNodes() .Path(@/My-Dashboard/Events@) .OnSite(secondSite) .Culture(@en-au@) .FirstObject; if ((originalPage != null) @@ (parentPage != null)) { // Inserts a new linked page under the parent page originalPage.InsertAsLink(parentPage); }

Viewing all articles
Browse latest Browse all 8901

Trending Articles