0

I need to write a job to create 1000s of items in Sitecore. I want to avoid, since there are 100s of fields:

newItem.Fields["Title"].Value = "NewValue1";

Can I use GlassMapper (which I believe needs to run in the MVC context) or an equivalent to do this instead?

1 Answers1

0

You have to map at least once even if it 100s of fields. You do not need to repeat that for 1000s of items. You should get all 1000 sourceObjects in a list and iterate over it to map its properties to Item fields.

 // Iterate through 1000s of items to create
forach(var sourceObject in SourceObjects)
{
    var newItem = New Item();
    newItem.Fields["Title"].Value = sourceObject.Title;
    // Field mapping for rest 99 fields
}