Trying to add external users to a Sharepoint site, getting user not found error

Welcome Forums General PowerShell Q&A Trying to add external users to a Sharepoint site, getting user not found error

Viewing 1 reply thread
  • Author
    Posts
    • #189511
      Participant
      Topics: 7
      Replies: 15
      Points: 103
      Rank: Participant

      Hi everyone:

      Looking for some assistance with the following:

      I have set up a new Sharepoint Team Site in my tenant. I have a csv of 150 external users' email addresses that will be needing access to this site. I'm using Sharepoint PNP and running this command....

      (Import-Csv C:\users\nelso\Documents\gpmusers.csv).email | ForEach {Add-PnPUserToGroup -LoginName $_ -Identity 6}

      Gives me the following error...

      Add-PnPUserToGroup : The specified user externaluser@externaldomain.com could not be found.
      At line:1 char:69
      + ... s.csv).email | ForEach {Add-PnPUserToGroup -LoginName $_ -Identity 6}
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo : WriteError: (:) [Add-PnPUserToGroup], ServerException
      + FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Principals.AddUserToGroup

      I realized that I haven't added these users anywhere into Office 365 in order for Sharepoint to find them. Would anyone know a way to achieve this? I came across this article....

      https://techcommunity.microsoft.com/t5/SharePoint-Developer/Can-I-add-External-users-to-a-SharePoint-group-using-PnP/m-p/68246

      Makes basic sense to me but I'm not an expert so not sure if this would solve my issue of getting these users into my tenant.

      Thanks in advance for any help.

      Nelson

    • #189997
      Participant
      Topics: 7
      Replies: 15
      Points: 103
      Rank: Participant

      Hello, just wanted to follow up that I ended up solving this. I had to bulk add my guests into Azure using this method...

      https://docs.microsoft.com/en-us/azure/active-directory/b2b/tutorial-bulk-invite

      Doesn't seen to be a way to do it in Powershell but works just as effectively. Once I did the upload, my command ran successfully.

      Hope this helps someone! Thanks.

Viewing 1 reply thread
  • You must be logged in to reply to this topic.