SharePoint Online: How to Add External User using PowerShell?

Requirement: Add External User to SharePoint Online using PowerShell.

How to Add External User in SharePoint Online?
SharePoint Online provides an excellent solution when you have to share any site, list, library, or document with users outside your organization such as vendors, clients, or partners. Before adding external users, we must ensure external sharing is enabled both at tenant level and at site collection levels (Refer: How to Enable External Sharing in SharePoint Online?),

If your external sharing setting is "Existing guests", then you must add the external user (or invite guest users to Azure AD in other words!)  to your Active Directory first!sharepoint online external sharing settings
External users or guest users do not need any license and can take advantage of SharePoint Online features!

Add External User to SharePoint Online Site
Here are the steps to add external users to SharePoint Online: To share a SharePoint site with an external user(s),
  • Login to your SharePoint Online site >> Click on the "Share" button from the top-right section of the page.
  • In the Share site pane, Enter the Emails of External users, make sure "Send email" checkbox is ticked, Optionally enter any message to the user and click on "Share" button the bottom. This triggers an Email to the external user with a link to accept the invitation.add external user to sharepoint online powershell
SharePoint Online Add External User to Group
You can also go to the "Site Permissions" page from Site Settings >> Site Permissions and add external users to the SharePoint Online group or directly grant permission to external users.
sharepoint online add external user to group

Similar steps involved to share a document library or a file with external users. Just hover over any existing document and click on the "Share" icon.
sharepoint online create external user

SharePoint Online PowerShell to Add External User to Group
Let's add an external user to SharePoint Online group using PnP PowerShell.
#Set Config Parameters
$SiteURL = "https://crescent.sharepoint.com/sites/SalesPortal"
$GroupName = "Sales Portal Members"
$ExternalUserEmail = "[email protected]"

#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)

#PowerShell to Add External User to group
Add-PnPUserToGroup -Identity $GroupName -EmailAddress $ExternalUserEmail -SendEmail

If you want to invite an external user to SharePoint Onlie using PowerShell CSOM, use: Add External User to SharePoint Online using PowerShell

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.