Kamran
Kamran

Reputation: 4100

get the recently added item from sitecore

If I create an item in sitecore from code behind using following code as shown in example under the heading Creating items:

//Now we can add the new item as a child to the parent
    parentItem.Add("NewItemName", template);

And then in order to get the this newly added item from sitecore database what I should do? Because I don't know the ID.

Upvotes: 1

Views: 78

Answers (1)

Komainu85
Komainu85

Reputation: 964

The new item will be returned by the add method.

Eg.

Item newItem = parentItem.Add("NewItemName", template);

Upvotes: 2

Related Questions