Looking back at a previous post, Creating predefined groups in site collection created by Powershell, I ran the following Powershell:
$web.CreateDefaultAssociatedGroups($web.Site.Owner.UserLogin, $web.Site.SecondaryContact.UserLogin, $web.Title)
$web.CreateDefaultAssociatedGroups($web.Site.Owner.UserLogin, $web.Site.SecondaryContact.UserLogin, $web.Title)
I went back into Site Permissions and still didn't see my groups. Reading the SPWeb.CreateDefaultAssociatedGroups Method document's Remarks, it mentions that the AssociatedVisitorGroup and the AssociatedOwnerGroup have to be null before invoking this method. Mine were set to point to the equivalent Home groups. So I ran the following:
$web.AssociatedOwnerGroup = $null
$web.AssociatedMemberGroup = $null
$web.AssociatedVisitorGroup = $null
$web.CreateDefaultAssociatedGroups($web.Site.Owner.UserLogin, $web.Site.SecondaryContact.UserLogin, $web.Title)
and all is fine.
$web.AssociatedOwnerGroup = $null
$web.AssociatedMemberGroup = $null
$web.AssociatedVisitorGroup = $null
$web.CreateDefaultAssociatedGroups($web.Site.Owner.UserLogin, $web.Site.SecondaryContact.UserLogin, $web.Title)
and all is fine.
No comments:
Post a Comment