CopyObject method: PortalRegistry class

Syntax

CopyObject(sourcePortalName, sourceRefType, sourceObjName, targetPortalName, targetPrntFldrName, copyChildren)

Description

Use the CopyObject method to copy folders and content references between portal registries.

If the object being copied has related HTML, the HTML is also copied and named according to the current portal naming convention for HTML objects, which is:

PR_<portalname>_<objectname> 

where <portalname> is up to the first 8 characters of the portal name and <objectname> is up to the first 17 characters of the object name.

Parameters

Parameter Description

sourcePortalName

Specify the name of the portal from which the object is to be copied.

sourceRefType

Specify the type of object to be copied. Values are:

  • "C" for content references

  • "F" for folders

This parameter is case-sensitive.

sourceObjName

Specify the name of the object to be copied.

targetPortalName

Specify the name of the portal to which the object will be copied.

targetPrntFldrName

Specify the name of the folder that will be the parent folder for the source object.

copyChildren

Specify whether to also copy the children of the source object. This parameter is valid only with folder objects. Values are:

  • "Yes" copy child objects

  • "No" do not copy child objects

This parameter is case-sensitive.

Returns

A Boolean value: True if object copied successfully, False otherwise.

Example

&Success = &Portal.CopyObject("PORTAL", "F", "PEOPLETOOLS_QUALITY", "BOGUS",⇒
 "PORTAL_ROOT_OBJECT", "Yes");
If (&Success = False) Then
   WinMessage("portal copy failed");
   Exit;
End-If;

Considerations Using CopyObject

The source portal name and the target portal name cannot be the same name.

The targetPrntFldrName must be a folder that exists in the portal identified by the target portal name. It cannot be null (or empty). If you need to copy an entire portal, the portal must first be "created" using the Create method, before copying over all the folders and content references.

The copyChildren parameter is ignored for content references. However, it still must be set to "Yes" or "No".