Add-PnPGroupMember

Tip

We encourage you to make improvements to this documentation. Please navigate to https://github.com/pnp/powershell/blob/dev/documentation/Add-PnPGroupMember.md to change this file.

Adds a user to a SharePoint group

Syntax

Add-PnPGroupMember
   -LoginName <String>
   -Group <GroupPipeBind>
    [-Connection <PnPConnection>]
   [<CommonParameters>]
Add-PnPGroupMember
   -Group <GroupPipeBind>
   -EmailAddress <String>
   [-SendEmail]
   [-EmailBody <String>]
   [-Connection <PnPConnection>]
   [<CommonParameters>]

Examples

EXAMPLE 1

Add-PnPGroupMember -LoginName user@company.com -Group 'Marketing Site Members'

Add the specified user to the SharePoint group "Marketing Site Members"

EXAMPLE 2

Add-PnPGroupMember -LoginName user@company.com -Group 5

Add the specified user to the SharePoint group with Id 5

Parameters

-Connection

Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection.

Type:PnPConnection
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-EmailAddress

The email address of the user

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-EmailBody
Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Group

The SharePoint group id, SharePoint group name or SharePoint group object to add the user to

Type:GroupPipeBind
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-LoginName

The login name of the user

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-SendEmail
Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False