Sitecore项目:已创建vs项目:已添加

M.R*_*.R. 7 c# asp.net sitecore content-management-system sitecore6

事件item:createdvs 之间有什么区别item:added?每个事件什么时候被击中?

Mar*_*lak 11

查看Sitecore.Data.Events.ItemAddedDelegate的代码,您可能会发现该委托已被弃用,您应该使用ItemCreatedDelegate.从我的测试:

  1. 创建新项目 - 已执行项目:已添加和已创建项目:已创建
  2. 克隆项目 - 已执行项目:已添加和已创建项目:已创建
  3. 复制项目 - 项目:已添加未执行,仅执行项目:已创建

    namespace Sitecore.Data.Events
    {
        [Obsolete("Use the ItemCreatedDelegate event instead.")]
        public delegate void ItemAddedDelegate(object sender, ItemAddedEventArgs args);
    }
    
    Run Code Online (Sandbox Code Playgroud)

所以一般来说,总是使用item:created