从 sitecore 获取最近添加的项目

get the recently added item from sitecore

如果我使用下面的代码 as shown in exampleCreating items 标题下从代码隐藏在 sitecore 中创建一个项目:

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

然后为了从 sitecore 数据库中获取这个新添加的项目我应该怎么做?因为我不知道ID。

新项目将通过add方法返回。

例如。

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