locked
How to change all Groups/Users permission level in batch mode? RRS feed

  • Question

  • Does anyone know of a way to make a mass change of all groups/users with permission level "X" to permission level "Y"?

    Example.  I created a custom permission level called "Owners" (which is not quite Full Control but close).  Now I need a way to modify the existing groups and users currently with "Full Control" to this custom permission level.  To do this manually would take a very very very long time so to do it in batch would be awesome.

    I have looked at a few of the admin tools out there but don't see this specific functionality listed.  Has anyone done somethign like this before?


    • Edited by Mike Walsh FIN Thursday, April 21, 2011 5:31 AM Need to changed to How to + ?
    Wednesday, April 20, 2011 6:16 PM

All replies

  • Hello ,

            Try the SPGroup and SPUser class.I am pretty sure you can loop through all groups and users with a 10 line code. That should do it for you , but please remember to give administrator rights.

     

    Deepankar Mohapatra


    Deepankar Mohapatra http://dmohapatra.in
    • Marked as answer by Leoyi Sun Tuesday, April 26, 2011 9:46 AM
    • Unmarked as answer by rcwynn Tuesday, April 26, 2011 1:06 PM
    • Edited by Mike Walsh FIN Tuesday, May 3, 2011 11:32 AM Please don't have e-mail addresses in your sig. 1. It encourages off-forum conversations 2. You will get a lot of spam
    Thursday, April 21, 2011 5:12 AM
  • Thanks for the tip, but I am not really a developer and this doesn't help much.  I was hoping someone else might know of a tool out there that could do this.  Or do you have a bit of sample code I could try out?

    Thanks.

    Tuesday, April 26, 2011 1:07 PM
  • Hey,

         Don't know about any tool but it would be easy to make one. try the following :

     

    SPRoleAssignment assignment = new SPRoleAssignment("dom\\user", "user@dom", "user", "some notes");

    SPRoleDefinition defination = web.RoleDefinitions.GetByType(SPRoleType.Contributor);

    assignment .RoleDefinitionBindings.Add(defination );

    if (!myList.HasUniqueRoleAssignments)

    {

        myList.BreakRoleInheritance(true); // Ensure we don't inherit permissions from parent

    myList.RoleAssignments.Add(assignment );

    myList.Update();

     

     

    let me know

     


    Deepankar Mohapatra http://dmohapatra.in

    Deepankar Mohapatra

    • Edited by Mike Walsh FIN Tuesday, May 3, 2011 11:33 AM Please don't have e-mail addresses in your sig. 1. It encourages off-forum conversations 2. You will get a lot of spam
    • Marked as answer by Leoyi Sun Thursday, May 5, 2011 9:58 AM
    • Unmarked as answer by rcwynn Thursday, May 5, 2011 7:46 PM
    Tuesday, May 3, 2011 11:19 AM
  • To Leoyi-  Please stop marking things as answers.  You don't know if the reply is what i am looking for or not.  Please do not try to think for me!

    To Deepankar-  Thanks for the insight, but my issue is with sub webs, not lists.  And I don't know if i really want inheritence to be broken if it isn't already.  All I really need to do is change the user or group permission level from "Full Control" to my new custom permission level.  Then any webs below will also inherit that change.

    Does anyone else know if one of these 3rd party tools can do this on a global/batch level? 

    Thursday, May 5, 2011 7:51 PM