Event Receiver and Elevated Privileges

Jan 26, 2011 at 7:37 PM

Hello Christian,

First: Great solution, thank you for your work.
Maybe you can give us a tip for our problem:
we want to change list item permissions with the event receiver sp 2010.
Our users has only Contribute permissions. When we try to change the permissions ,something like

function itemadded() {

if($item.HasUniqueRoleAssignments -eq $false) {

$user = $web.AllUsers["DOMAIN\user"]
$roledef = $web.RoleDefinitions["Vollzugirff"]
$roleass = New-Object Microsoft.SharePoint.SPRoleAssignment($user)


We get an error. I think, the event receiver is running under the user permissions.

Is there a way to run the powershell code with elevated privileges?

Thank you



Oct 8, 2012 at 1:27 PM


is there a solution for this cause?

I have the same problem, that users with contribute permission can´t  BreakRoleInheritance via the eventreceiver at itemadded.

Oct 8, 2012 at 2:35 PM
Edited Oct 8, 2012 at 2:35 PM


I use this code:

if($item.HasUniqueRoleAssignments -eq $false) {
    $w = Get-SPWeb -webUrl $web.Url
    $l = $w.Lists[$list.ID]
    $i = $l.GetItemByID($item.ID)
    $i.BreakRoleInheritance($false, $true)

 In this case using System Account context.