Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add an item with a predefined language using Sitecore?

For a project I'm using Sitecore 6.5. It's a multi-language project. I want to add an item in programcode with a predefined languange, for example Dutch.

I searched the whole internet, but I can't find the right way. Does anyone know how i could solve this?

Thanks a lot.

Jordy

like image 417
Jordy Avatar asked Dec 27 '25 15:12

Jordy


1 Answers

First time you get the parent item in dutch :

Language languageDutch=Language.Parse("nl-nl");

   ////parentItemId is the item under you want to create child
   Item parentItem=Sitecore.Context.Item.GetItem(parentItemId, Language languageDutch)

after you create child item in dutch like :

parentItem.AddItem("child item name",TemplateId) .


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!