AnsweredAssumed Answered

Multiple file attachments to Content

Question asked by johnpneal on Jan 6, 2011
Latest reply on Feb 2, 2011 by johnpneal
Hello:

I am new to Alfresco and have been struggling with this issue and I hope I posted to the correct forum and searched before posting.  Our team wants to import into Alfresco via an acp file a content type that can have 0 to many attachments.  We created a content model and the element pertaining to the attachments and successfully installed it looks like this:

<model name="hs:HotelSolution" xmlns="http://www.alfresco.org/model/dictionary/1.0">

   <!– Optional meta-data about the model –>  
   <description>Hotel Solution Content Model</description>
   <author>development team</author>
   <version>1.0</version>

   <imports>
        <!– Import Alfresco Dictionary Definitions –>
      <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
      <!– Import Alfresco Content Domain Model Definitions –>
      <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
   </imports>

   <!– Introduction of new namespaces defined by this model –>
   <namespaces>
      <namespace uri="http://www.ihgmerlin.com/hotelSolution" prefix="hs"/>
   </namespaces>
  
   <types>
      <!– Definition of new Content Type: Idea Content –>
      <type name="hs:IdeaContent">
         <title>Hotel Solution Idea Content</title>
         <parent>cm:content</parent>
         <properties>
            <property name="hs:name">
               <type>d:text</type>
            </property>
            <property name="hs:hotel">
               <type>d:text</type>
            </property>
            <property name="hs:title">
               <type>d:text</type>
            </property>
         </properties>
         <associations/>
      </type>
      <!– Definition of new Content Type: Idea Attachment –>
      <type name="hs:IdeaAttachment">
         <title>Hotel Solution Idea Attachment</title>
         <parent>cm:content</parent>
         <properties>
            <property name="hs:NameValue">
               <type>d:text</type>
            </property>
            <property name="hs:HotelValue">
               <type>d:text</type>
            </property>
            <property name="hs:TitleValue">
               <type>d:text</type>
            </property>
[color=#FF0000]            <property name="hs:Attachments" multiple="true">
               <type>d:content</type>
            </property>[/color]
         </properties>
         <associations/>
      </type>
    </types>
    <aspects/>
</model>

The main element in question is:

[color=#FF0000]            <property name="hs:Attachments" multiple="true">
               <type>d:content</type>
            </property>[/color]
We are able to create the acp file successfully and import it into Alfresco.  However, with multiple attachments we only get 1 attachment to upload when checking via the node browser.  The snippet from the xml file contained in the acp that we created looks like this to upload 2 pdf files as attachments:

[color=#FF0000]      <hs:Attachments>
        <view:values>
         <view:value>contentUrl=Export with Attachments\content0.pdf|mimetype=application/pdf|size=140610|encoding=UTF-8|locale=en_US_</view:value>
                   <view:value>contentUrl=Export with Attachments\content1.pdf|mimetype=application/pdf|size=140610|encoding=UTF-8|locale=en_US_</view:value>
        </view:values>
      </hs:Attachments>[/color]

We modeled this after creating a text field that had multiple set to true and though it was partially successful, as stated before, only 1 file uploaded.  Could anyone help out with determining how to properly format the Content Model and.or the xml for the acp?  I know we are close but as I said we are new and struggling a little.  Any help is appreciated.

Regards

Outcomes