Hi Friends,
I have a some Groups like L1, L2, L3, L4…etc..
what I want is ….
if some User from L2 Group has created some Item then only one level down (L3) Group will be able to see these Item not other groups…could you suggest what is the Best way to do it or Is it available as OOTB?
HI Randive,
thanks for your reply…but it can not be done by setting because Its not static as i have said earlier too.
i’ve got it done by some extent by this code..but here problem is..to execute this code User must be having the rights Admin Rights..
=================
SPSecurity.RunWithElevatedPrivileges(delegate()
{
//grant permissions for specific list item
SPSite site = new SPSite(“http://———————-“);
SPWeb web = site.OpenWeb();
string UN = “”;
SPUser userName = null; // web.SiteUsers[“B1”];
foreach (SPUser usr in web.SiteUsers)
{
if(usr.Name == “A1”)
{
userName = usr;
}
}
string x = “”;
properties.ListItem.BreakRoleInheritance(true);
SPRoleAssignmentCollection SPRoleAssColn = properties.ListItem.RoleAssignments;
for (int i = SPRoleAssColn.Count – 1; i >= 0; i–)
{
SPRoleAssColn.Remove(i);
}
SPRoleDefinition roleDefintion = web.RoleDefinitions[“Only Edit Custom”];
//SPRoleDefinition roleDefintion = web.RoleDefinitions.GetByType(SPRoleType.Contributor);
SPRoleAssignment roleAssignment = new SPRoleAssignment(userName);
roleAssignment.RoleDefinitionBindings.Add(roleDefintion);
properties.ListItem.RoleAssignments.Add(roleAssignment);
properties.ListItem.Update();
});
============================================
