Create Copy of DCR With OpenAPI

I want to copy an existing DCR and give it a new DCR name using OpenAPI but not sure how to do this. I was able to make a copy of the DCR with IWFileHandle but then NOT able to edit the data record since its type is a file and not DCR. Can you add a DCR with OpenAPI?

Thx
Briscoe

Comments

  • If you just copy the file contents, then Templating won't recognize the copy as a DCR because it won't have the necessary Extended Attributes. You probably need to apply the proper EA's to the copy.

    Hope this helps.
    -- James

    --
    James H Koh
    Interwoven Engineering
  • Thanks James

    This does help. I assume that OpenAPI supports adding the Extended Attributes after I create the DCR copy.

    Thanks again

    Briscoe
  • Below is the code sniplet that updates an Extended Attribute just in case someone wants to reference.

    Thanks,
    Briscoe

    IWSimpleFile sf = (IWSimpleFile) IWPathNamedObject.lookupByPath(fileSysService, tmpPath + "/" + fileName);

    if( sf == null )
    {
    sf = dir.createChildSimpleFile(fileSysService, fileName, null, null, "LiveWoven Export");
    }

    if( sf == null )
    {
    logFile.Print("IWOpenAPI:ExportFileExAttr", "Could Not Create File - " + fileName + " In Export Path - " + tmpPath, "ERROR");
    return false;
    }

    // Set Extended Attribute
    sf.setVarValue fileSysService, "TeamSite/Templating/DCR/Type", "Category/Content Type");
TeamSite Developer Resources

  • Docker Automation

  • LiveSite Content Services (LSCS) REST API

  • Single Page Application (SPA) Modules

  • TeamSite Add-ons

If you are interested in gaining full access to the content, you can register for a My Support account here.
image
OpenText CE Products
TeamSite
APIs