I have a simple list with an event receiver for the following events:
- ItemAdded
- ItemUpdating
- ItemDeleting
I confirmed that the event receiver fires when adding/updating/deleting an item from the SharePoint user interface.
However, it doesn't fire when I create the list item from a PowerShell script. The item is added to the list but the event receiver doesn't fire. Any thoughts on why this is?
Here's the relevant snippet of the PowerShell script:
# read offices from Data-Offices.xml
$officeData = [xml](Get-Content .\data\Data-Offices.xml)
# iterate through items and create them in Office list
foreach ($office in $officeData.offices.office)
{
$newItem = $list.items.Add();
$newItem["Title"] = $office.title;
$newItem.Update()
Write-Host "Added Office: " $office.title
}
Wondering if there's a permissions issue here ... Tried running the script as an administrator but that didn't resolve the issue.
Thank you