0

I've just tried out a nice feature in Sitecore Rocks which is to import data & create a tree in the content tree, using the Query Analyzer, following this documentation.

The data in the text file will be in this format:

* News|/sitecore/templates/Common/Folder
** 2019|/sitecore/templates/Common/Folder
*** Month|/sitecore/templates/Month|12

But, it will only create the items in the tree structure. Is there a way where we can also populate the field values.

1

It looks like what you want to do is not possible with a Tree Import - that only creates the items, you would then have to get the items and populate fields after.

CSV Import:

Alternatively you could use the CVS import source. This allows you to populate fields at the time of creation:

import csv
" 
,
@ItemName, Title, Text
Home, Sitecore, "Welcome to Sitecore"
"

In that example, it is setting a default template, and then the columns define the properties of each item.

Update items after a Tree Import

One more option would be to update the items after the tree import by using the update command in the Query Analyzer:

update set 
  @Title = "Welcome to Sitecore", 
  @Text = "Hello" 
from /sitecore/content/Home

This seems a little more effort to write out, but would give you what you need.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.