I run the powershell script for adding list item. I've executed the script with site collection admin right and other user (distribute) but ItemAdded event doesn't get fired.
Please let me know what I am missing.
Windows 2008 R2 / Sharepoint 2010
Many thanks
$web = Get-SPWeb $WebUrl $list = $web.Lists[$ListName] $newItem = $list.Items.Add() $assem = [Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint"); $type = $assem.GetType("Microsoft.SharePoint.SPEventManager"); $prop = $type.GetProperty([string]"EventFiringDisabled",[System.Reflection.BindingFlags] ([System.Reflection.BindingFlags]::NonPublic -bor [System.Reflection.BindingFlags]::Static)); $prop.SetValue($null, $false, $null); $newItem["Field1"] = "Field1" $newItem["Field1"] = "Field2" $newItem["Field1"] = "Field3" $newItem["Editor"]=$web.EnsureUser("i:0#.f|adprovider|user1") $newItem.Update()I determined that object properties in itemAdded function is null if I execute by powershell. What should I do?
public override void ItemAdded(SPItemEventProperties properties)
- Edited by diepkv 4 hours 24 minutes ago