am trying to grant read permissions to all the users of my site collection to an particular item in an itemupdated event receiver:
this is my code :
SPRoleDefinition readerRole = CurrentWeb.RoleDefinitions.GetByType(SPRoleType.Reader);
SPUser spallusers = CurrentWeb.EnsureUser("NT AUTHORITY\\Authenticated Users");
// CurrentWeb.AllUsers;
SPRoleAssignment spRoleAssignmentalluser = new SPRoleAssignment(spallusers);
spRoleAssignmentalluser.RoleDefinitionBindings.Add(readerRole);
CurrentWeb.RoleAssignments.Add(spRoleAssignmentalluser);
CurrentWeb.Update();
///end of app read permissions
this.EventFiringEnabled = true;
});
but somehow, it didnt throw any error but the permissions are not granted to everyone in my SP 2013 site colection's item thats residing in the document library.
so
ntauthority\authenticated users is not working while applying permissions
should everyone will work?