Created
December 16, 2022 00:10
-
-
Save fluxdigital/dd24b627e34300280957c09c17eea9e2 to your computer and use it in GitHub Desktop.
Create Sitecore Item - ChatGPT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set the necessary parameters for the new item | |
$itemName = "My New Item" | |
$itemTemplate = "{76036F5E-CBCE-46D1-AF0A-4143F9B557AA}" #Sample Item | |
$parentItemPath = "/sitecore/content/Home" | |
# Create the new item | |
$newItem = New-Item -ItemType $itemTemplate -Name $itemName -Path $parentItemPath | |
# Set the new item's field values | |
$newItem.Editing.BeginEdit() | |
$newItem["Title"] = "My New Item Title" | |
$newItem["Description"] = "My new item description" | |
$newItem.Editing.EndEdit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment