简体   繁体   中英

tridion 2009 - copy multimedia component from one publication to another

How do I copy a image component, from one publication to the other using api's in 2009?

Is this possible? I tried using

    newComponent.Multimedia.SetUploadedMultimediaFilename(originalComponent.Multimedia.Filename);

+newComponent.save(); where my newComponent is the one that I am creating from the original component.

    <tcm:Error xmlns:tcm="http://www.tridion.com/ContentManager/5.0"                                                         ErrorCode="80040325" Category="3" Source="Kernel" Severity="2">
    - <tcm:Line ErrorCode="80040325" Cause="false" MessageID="16137">
    - <![CDATA[ Unable to save Component (tcm:0-0-0).
      ]]> 
      <tcm:Token>RESID_4574</tcm:Token> 
      <tcm:Token>RESID_4418</tcm:Token> 
      <tcm:Token>tcm:0-0-0</tcm:Token> 
      </tcm:Line>
    - <tcm:Line ErrorCode="80040325" Cause="true" MessageID="16010">
    - <![CDATA[ Operation is not supported on a new item (or on a null URI).
      ]]> 
      </tcm:Line>
    - <tcm:Details>
    - <tcm:CallStack>
      <tcm:Location>UtilitiesBL.AssertValidURI</tcm:Location> 
      <tcm:Location>ComponentBL.CheckMultiMediaProperties</tcm:Location> 
      <tcm:Location>ComponentBL.Create</tcm:Location> 
      <tcm:Location>XMLState.Save</tcm:Location> 
      <tcm:Location>Component.Save</tcm:Location> 
      </tcm:CallStack>
      </tcm:Details>
      </tcm:Error>

That won't work... you'll need to first save the multimedia item to a file location, then use this location to upload it from. All you're doing now is telling Tridion that there is a file at originalComponent.Multimedia.Filename which may or may not be true.

N

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM