Home
TeamSite
Create Copy of DCR With OpenAPI
briscoe
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
Find more posts tagged with
Comments
james1
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
briscoe
Thanks James
This does help. I assume that OpenAPI supports adding the Extended Attributes after I create the DCR copy.
Thanks again
Briscoe
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");