content contentRef addLinkTo

Available for: Content Management Server

Task: Creates a free link and adds it to the specified field in the draft version.

Syntax:

content withId contentId addLinkTo attribute attrName destinationUrl urlString

Function parameters:

  • attrName is the name of the field to which the free link is to be added. The concerning field’s type must be linklist.
  • target is the target frame.
  • title is the link title.
  • destinationUrl is the link destination.

Return value if successful: the ID of the new link (string).

Necessary permissions: The user must be the editor of the version and have the permissionWrite permission for the file the version belongs to.

Example: Add a free link to the imageLinks field in version with id 25687; the link points to the location file in the same folder::

CM>content withId 25687 addLinkTo \
   attribute imageLinks destinationUrl location
9983433

Example: Add a free link to the imageLinks field in the draft version of the newslist file; the link points to the location file in the same folder:

CM>obj withPath /newslist editedContent addLinkTo \
   attribute imageLinks destinationUrl location
9983434