Create linked document

  Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic! Mail us feedback on this topic!  

[C#]

 

using CMS.SettingsProvider;

using CMS.CMSHelper;

using CMS.DataEngine;

using CMS.GlobalHelper;

using CMS.TreeEngine;

using CMS.SiteProvider;

 

...

 

          // Prepare the TreeProvider

          // it must be initialized with user information when editing document structure

           UserInfo ui = UserInfoProvider.GetUserInfo("administrator");

           TreeProvider tree = new TreeProvider(ui);

         

          // Get the document (current culture)

           CMS.TreeEngine.TreeNode node = tree.SelectSingleNode(CMSContext.CurrentSiteName, "/TestingNews", CMSContext.CurrentUser.PreferredCultureCode, false, null, false);

          if (node != null)

           {

              // Update the data

               node.SetValue("NodeAlias", "TestingNewsLink");

             

              // Insert new culture version of the document in the same site section

               node.InsertAsLink(node.NodeParentID);

 

              this.lblInfo.Text = "New link '" + node.NodeAliasPath + "' to the document '/TestingNews' has been created.";

           }

 

Page url: http://devnet.kentico.com/docs/devguide/index.html?create_linked_document.htm