MOSS Forum

Ask Question   UnAnswered
Home » Forum » MOSS       RSS Feeds

Programatically breaking site inheritance

  Asked By: Roxana    Date: Apr 21    Category: MOSS    Views: 1938

I have a MOSS 2007 Portal with lots of subsites. All of them have been
created with inheritance.
Is there any way to run through all the subsites and break inheritance
from their parent sites?
I know I could do this manually, but I am in a time crunch and need to
get this taken care of asap!



1 Answer Found

Answer #1    Answered By: Kacie Calhoun     Answered On: Apr 21

Call the BreakRoleInheritance method on each SPWeb object in the site
collection. Pass a single Boolean parameter of true if you want it to Copy the
existing permissions when inheritance  is broken. If you do this recursively
while walking the site  collection hierarchy I would also include a check on
whether inheritance has already been broken by using the
HasUniqueRoleDefinitions property of the SPWeb object before breaking

Didn't find what you were looking for? Find more on Programatically breaking site inheritance Or get search suggestion and latest updates.