This project is read-only.

Importing new Content Items

Topics: Writing modules
Jul 27, 2012 at 11:15 PM

So I've been playing around with Exporting/Importing today and followed some of the posts that indicate that your part must have a unique ID in order to import it.

I modified one of my types and added the IdentityPart to it, exported it and imported back in with changes. Works great since the ID field of my part was filled in with the IdentityPart ID

My question is, is it possible to import new Items without having to generate a ID for each new record in the XML file? Honestly, I was expecting the system to auto-generate it upon import (wishful thinking huh?) =)

If I have a list of 4000 records that I want to import as my custom Content Part, do I have to manually create a unique ID for each one?

Jul 28, 2012 at 12:29 PM

No, you need some sort of id, but that can be something you specify yourself. Aliases for example, work just as well as the identity part at providing identity.

Jul 30, 2012 at 9:11 PM

Thanks for the Alias suggestion...I think it will work for what I need to import without having to code each one with a GUID.

Jul 30, 2012 at 10:52 PM

Can you point me to the correct syntax to add Alias to my Type in Migrations? Do I need to add a reference to Orchard.Alias for it or is it in Core?

Thanks again!

Jul 31, 2012 at 4:31 PM

You mean Autoroute?

Jul 31, 2012 at 6:09 PM

Oh...I didn't realize it was the Autoroute part that enabled Aliases. Okay, that's easy enough.

I'll play around with that. I'm hoping for this group of 4000 records, I can just use "/request/#" where number is the Request Number.