Note: Forums will be making significant UX changes to address key usability improvements surrounding search, discoverability and navigation. To learn more about these changes please visit the announcement which can be found HERE.

คำตอบ Bulk load users in a group

ตอบทั้งหมด

  • 13 มีนาคม 2555 22:07
     
     

    Hi ChitraSaha,

    Usually you will have groups already defined in AD and have included them using SharePoint's User Profile synchronization Service. It helps if you are targeting multiple groups to have them added to one group for easier maintenance. 

    For more information see: http://blogs.msdn.com/b/spsocial/archive/2010/05/04/conceptual-view-of-how-user-profile-synchronization-works-in-sharepoint-2010.aspx


    Kind Regards, Justin Nash

  • 13 มีนาคม 2555 23:07
     
     คำตอบ

    Hi ChitraSaha.

    What you preferably do is add all the users to a AD group, then add that AD group to a SharePoint group. That way, you can administer the users access in AD and SharePoint.
    But, if this is not an option, then you could use Powershell to add all the users. My good friend Niklas Goude tells you how:
    http://www.powershell.nu/2009/01/06/adding-user-to-group-in-sharepoint/

    Configure it to read all users from a csv file or xml file and it will work. Remember though, there is a limitation on the number of users a SharePoint group can hold...better to use AD.

    Regards


    Thomas Balkeståhl - Technical Specialist - SharePoint - http://blog.blksthl.com
    Download the SharePoint Branding Project here

    • เสนอเป็นคำตอบโดย Jason Li - Canada 17 มีนาคม 2555 6:49
    • ทำเครื่องหมายเป็นคำตอบโดย Emir LiuMicrosoft, Moderator 23 มีนาคม 2555 2:49
    •  
  • 14 มีนาคม 2555 14:28
     
     
    Hello!

    Following the link

    http://www.powershell.nu/2009/01/06/adding-user-to-group-in-sharepoint/

    1[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")

    2.$SPSite = New-Object Microsoft.SharePoint.SPSite("http://wss"); $OpenWeb = $SpSite.

    3. $User | ForEach-Object {
        $TheNewGroup.AddUser(
            $_.test,
            $_.test@sss.yyy,
            $_.test,
            ""
    )
    }

    But I get the error

    Missing ')' in method call.
    At line:4 char:15
    +         $_.test <<<< @sss.yyy,
        + CategoryInfo          : ParserError: (CloseParenToken:TokenId) [], Paren
       tContainsErrorRecordException
        + FullyQualifiedErrorId : MissingEndParenthesisInMethodCall

    Please advice
  • 16 มีนาคม 2555 12:07
     
     

    Hi

    I tried it and it works for me. Perhaps just a copy-paste-error? Try this (replace with your site and groupname)

    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")

    $SPSite = New-Object Microsoft.SharePoint.SPSite("http://mysharepointsite"); $OpenWeb = $SpSite.OpenWeb(); $TheNewGroup = $OpenWeb.SiteGroups | Where-Object {$_.Name -match "myGroupName"}; $OpenWeb.Dispose(); $SPSite.Dispose()


    $SPSite = New-Object Microsoft.SharePoint.SPSite("http://mysharepointsite"); $OpenWeb = $SpSite.OpenWeb(); $User = $OpenWeb.Users | Select Name, Email, LoginName; $OpenWeb.Dispose(); $SPSite.Dispose()

    $User | ForEach-Object {$TheNewGroup.AddUser($_.LoginName,$_.Email,$_.Name,"")}

  • 16 มีนาคม 2555 16:15
     
     

    After executing the following statement:

    $SPSite = New-Object Microsoft.SharePoint.SPSite("http://test"); $OpenWeb = $SpSite.OpenWeb(); $User = $OpenWeb.Users | Select Name, Email, LoginName; $OpenWeb.Dispose(); $SPSite.Dispose()

    Error

    New-Object : A positional parameter cannot be found that accepts argument 'Stud
    ent Life'.
    At line:1 char:21
    + $SPSite = New-Object <<<<  Microsoft.SharePoint.SPSite("http://test")$OpenWeb = $SpSite.OpenWeb(); $User = $OpenWeb.Users | Select Name, Emai
    l, LoginName; $OpenWeb.Dispose(); $SPSite.Dispose()
        + CategoryInfo          : InvalidArgument: (:) [New-Object], ParameterBind
       ingException
        + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell
       .Commands.NewObjectCommand

    Please advice

  • 16 มีนาคม 2555 16:25
     
     
    I think I got it!
  • 16 มีนาคม 2555 19:33
     
     

    Hello!

    Cannot get the following script working:

    $User | ForEach-Object{$TheNewGroup.AddUser($_.test,$_.test@sss.xxx,$_.test lastname,"")}


    PS C:\Scripts> .\user.ps1
    Missing ')' in method call.
    At C:\Scripts\user.ps1:1 char:58
    + $User | ForEach-Object{$TheNewGroup.AddUser($_.test,$_.test <<<< @sss.xxx,$_.test LastName,"")}
        + CategoryInfo          : ParserError: (CloseParenToken:TokenId) [], Parse
       Exception
        + FullyQualifiedErrorId : MissingEndParenthesisInMethodCall

  • 16 มีนาคม 2555 20:42
     
     

    Hi.

    If you are trying to add the string '@sss.xxx' to the $_.test then I think that you need to do it better.
    Try:

    $User | ForEach-Object{$TheNewGroup.AddUser($_.test,$_.test + "@sss.xxx",$_.test lastname,"")}

    Or:

    $User | ForEach-Object{
    $email = $_.test+"@sss.xxx";
    $TheNewGroup.AddUser($_.test,$email,$_.test lastname,"")
    }

    Regards


    Thomas Balkeståhl - Technical Specialist - SharePoint - http://blog.blksthl.com
    Download the SharePoint Branding Project here