Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Exception calling "CreateDefaultAssociatedGroups" with "3" argument(s):

$
0
0

hi,

 i am tryng to create site collection  through power shell and when i am trying to add the users into default  groups i am geettng the erros :

$Rootweb=New-Object Microsoft.Sharepoint.Spsite($webappln);
$Webapp=$Rootweb.Webapplication;

Foreach ($Site in $Webapp.Sites)
{
write-host -foregroundolor yellow "inside foreach ---"
$Web=$Site.Rootweb; $Site.Url + "," + $Site.Owner.Name + ","
write-host -foregroundolor yellow "first site url --" $Site.Url
write-host -foregroundolor yellow "root web of " $Site.Url " is going to be shown" $Web
write-host -foregroundolor yellow "starting to associate default groups" $Web.Title
$Web.EnsureUser($usrname)
$Web.CreateDefaultAssociatedGroups($usrname,"", "") 
write-host -foregroundolor yellow "success in in creating groups for" $Web.Title
$Site.Dispose()

};

i:0#.w|in\username3 (C...
Exception calling "CreateDefaultAssociatedGroups" with "3" argument(s): "User
cannot be found."
At D:\myworkspace\bif\getsetowners.ps1:18 char:1
+ $Web.CreateDefaultAssociatedGroups($usrname,"", "")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : SPException

//////////////////////////////////////////////////////

I just want to know

$Web.CreateDefaultAssociatedGroups () what are the parameters i need to pass within this method:

i have passed the first parameter $usrname and kept the other two parasm as  empty.

will this cause an issue?

help is appreciated!



Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>