Skip to content

New-Item should be able to work with Item given as -Parent rather than paths only #2

@krzysztof-chmiel

Description

@krzysztof-chmiel

In my environment I have items with the same paths. I workarounded item creation by creating child directly in parent item:

$templateId = New-Object "Sitecore.Data.TemplateID" (New-Object "Sitecore.Data.ID" "{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}");
$newItem = $item.Add("test-item", $templateId);

In my case a -Parent and -NewItemName parameters to the New-Item command would be more approprieate as using Path would create Item only under one of my items.

Please note that using parent by newly created item can take it's language version. That would simplify running scripts in multilanguage environment.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions