2

I am attempting to import data into Orchard CMS. I have a custom type, made up of parts and fields, and I am using the ImportExport module. I have exported some data from Orchard to ensure the XML schema is correct, but when importing, the only field that seems to be populating is the TitlePart Title. I have randomly generated a GUID for the identifier of each record. Orchard 1.4, ImportExport 1.4.

Example of one item of data:

<Orchard>
  <Recipe>
    <Name>Data Import</Name>
    <Author>myaccount</Author>
  </Recipe>
  <Data>
    <OurPropertiesDivision Id="/Identifier=94eff3237c714f98b021905c33d25ea9" Status="Published">
      <LinkField.Link Text="This is a link" Url="http://stackoverflow.com" />
      <MediaPickerField.ImageOne Url="~/test.jpg" Width="100" Height="100" />
      <MediaPickerField.ImageTwo Url="~/test2.jpg" Width="100" Height="100" />
      <MediaPickerField.ImageThree Url="~/test3.jpg" Width="100" Height="100" />
      <TitlePart Title="Test Title" />
      <CommonPart Owner="/User.UserName=myaccount" CreatedUtc="2012-04-04T23:03:39Z" PublishedUtc="2012-04-04T23:03:39Z" ModifiedUtc="2012-04-04T23:03:39Z" />
      <IdentityPart Identifier="94eff3237c714f98b021905c33d25ea9" />
    </OurPropertiesDivision>
  </Data>
</Orchard>

This results in the following when looking at the imported entry:

Content list:

Orchard Content List

Edit screen:

Orchard Edit Screen

The only field that is making it through the import is the TitlePart. How can I make this work in a way that I can bulk insert any type of field or part with data? I would also like to capture the Container for the Containable part.

EDIT: Adding content type metadata

<?xml version="1.0"?>
<!--Exported from Orchard-->
-<Orchard>
  -<Recipe>
    <Name>Generated by Orchard.ImportExport</Name>
    <Author>myaccount</Author>
  </Recipe> -<Metadata>
    -<Types>
      -<OurPropertiesDivision DisplayName="Our Properties - Division" ContentTypeSettings.Draftable="True" ContentTypeSettings.Creatable="True">
        <CommonPart DateEditorSettings.ShowDateEditor="False" OwnerEditorSettings.ShowOwnerEditor="False"/>
        <TitlePart/>
        <OurPropertiesDivision/>
        <ContainablePart/>
        <IdentityPart/>
      </OurPropertiesDivision>
    </Types> -<Parts>
      <CommonPart ContentPartSettings.Attachable="True"/> <TitlePart ContentPartSettings.Attachable="True"/> -<OurPropertiesDivision ContentPartSettings.Attachable="True">
        <ImageOne.MediaPickerField DisplayName="Image One" MediaPickerFieldSettings.Required="False" HtmlFieldSettings.FlavorDefault="html"/>
        <ImageTwo.MediaPickerField DisplayName="Image Two" MediaPickerFieldSettings.Required="False" HtmlFieldSettings.FlavorDefault="html"/>
        <ImageThree.MediaPickerField DisplayName="Image Three" MediaPickerFieldSettings.Required="False" HtmlFieldSettings.FlavorDefault="html"/>
        <Content.HtmlField DisplayName="Content" HtmlFieldSettings.FlavorDefault="html"/>
        <Link.LinkField DisplayName="Link" HtmlFieldSettings.FlavorDefault="html" LinkFieldSettings.LinkTextMode="Required" LinkFieldSettings.TargetMode="NewWindow" LinkFieldSettings.Required="True"/>
      </OurPropertiesDivision> <ContainablePart ContentPartSettings.Attachable="True"/> <IdentityPart ContentPartSettings.Attachable="True"/>
    </Parts>
  </Metadata>
</Orchard>
4

1 回答 1

0

我最终分析了管理员生成的数据库插入,并在 SQL 中手动导入数据。

于 2012-05-23T14:55:22.083 回答