This project is read-only.

PowerEventReceivers 2.0

Dec 16, 2008 at 7:08 AM
   Use PowerEventReceivers 2.0 ,create a script in "Power Item Event Receiver" on function ItemAdded.
   When ItemAdd , new item line  is inserted into other list. Like:
            $TaskList = $web.Lists["Task"];
            $TaskItem = $TaskList.items.add()

            $TaskItem["Title"] = $item["Title"]
            $TaskItem["TaskType] = $item["TaskType"]
            $TaskItem["ProjectName"] = $item["ProjectName"]

   When one or more fields of item do not input value,this function is  invalidation.But when all fields of item have value,this function is good.
   No error message,only the 'Task' list have not the new Item. Why?

Dec 16, 2008 at 11:11 AM
Hi Gary,

please check the systems event log for an error.
To debug I recommend using 
"my message" | out-file "C:\dump.txt" -append

you can trap exceptions like
# script which cause an exception
trap [Exception]
    $_.Exception.Message | out-file "C:\dump.txt" -append

Feb 25, 2009 at 8:56 PM
Edited Feb 25, 2009 at 9:00 PM
Hi, Christian!
In functions ItemAdded I need to perform  code $item.BreakRoleInheritance($false);...
In general, the code must be execute with the help of SPSecurity.RunWithElevatedPrivileges...
How can this be done?