Ticket (Solved)

Import / Creating many content items [recipe without identifiers] - possible?

Hi all, I have a content item that is basically an image, which I gather as a group and display in a slider. Everything works great when I manually create the content [upload image / select it, and display it] – but I’m now in the situation where I need to upload hundreds of images – and therefore – create a content item for each. How could I go about this efficiently? What springs to mind, is to create an import recipe – but was wondering if it would even work if the recipe didn’t have identifiers [as they haven’t been created, yet] i.e.:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<!--Exported from Orchard-->
<Orchard>
  <Recipe>
    <ExportUtc>2016-11-14T02:14:40.3110905Z</ExportUtc>
  </Recipe>
  <Content>
    <GalleryThumb Id="/Identifier=" Status="Published">
      <MediaLibraryPickerField.Picture ContentItems="/Identifier=WOULDNT-EXIST" />
      <CommonPart Owner="/User.UserName=admin" CreatedUtc="2016-02-15T03:58:23.0865587Z" PublishedUtc="2016-09-21T03:05:57.1083829Z" ModifiedUtc="2016-02-15T03:58:23.12556Z" />
      <GalleryThumbPart LargeImage="false" GroupName="testGallery" SlideOrder="0" />
      <IdentityPart Identifier="###???###" />
      <LayoutPart>
...

has anyone struck and sorted such a workflow - the idea of manually doing this makes me feel ill - ha! Thanks for any thoughts - it will be greatly appreciated, Pug

Re: Import / Creating many content items [recipe without identifiers] - possible?

So, the way I see it – I may have to:

• Import all images first to a specific folder via Media Module.

• Create a custom module that,

• Loops through those images and checks if a content-item in question already exists that uses current iterated image, if not – create content-item with image, else, ignore.

Does this seem like the only logical option, or can you suggest a better concept? Thanks guys.

Tuesday, November 15, 2016 12:37:12 AM bypug
  • pug
  • Lv. 04 Rookie
  • Total EXP: 144

Re: Import / Creating many content items [recipe without identifiers] - possible?

Which version of Orchard is this? Orchard 1.8 and later has a module called Media Library that has an Image content type out of box, and allows you to mas-upload image files, creating an Image content item for each.

If you can't use that module for some reason, then the best way I can think of is to create a custom module with a custom controller that allows you to select multiple files and create content items for each uploaded file (including any logic you need, such as checking if there already is a content item that reflects the uploaded file in question).

Sunday, December 4, 2016 6:52:36 AM bysfmskywalker

Re: Import / Creating many content items [recipe without identifiers] - possible?

sorry for the very late 'thanks' @sfmskywalker...yeah, in the end I changed my approach to use both Image content types and/or refer directly to a folder of images; works well for the scenarios I'm using it with. Thanks for your support, Pug

Sunday, December 18, 2016 5:34:33 AM bypug
  • pug
  • Lv. 04 Rookie
  • Total EXP: 144

Post a reply

You need to be signed in to post a reply.

Sign In