Forum Discussion
RicardoGarrido
Jan 10, 2022Copper Contributor
How do we share a OneDrive file with an external user using Powershell?
I'm trying to share OneDrive files with external users via Powershell, using the Set-PnPListItemPermission from the PnP.Powershell module.
I can successfully share files with other users in the organization, but cannot share with an external user.
$TargetListName = 'Documents'
$FileID = '<OneDriveFileID>'
$ExternalEmailAddress = 'Email address removed'
Set-PnPListItemPermission -List $TargetListName -Identity $FileID -User $ExternalEmailAddress -AddRole 'Read'
Thanks in advance.
- I think this might be a limit of the PnPListItemPermission cmdle...Is the external user a guest in your Azure AD? If that's not the case, I think that's the reason why the cmdlet is not working
- RicardoGarridoCopper Contributor
The user is not a guest in Azure AD. When we share a file with an external user with the GUI, it does not seem to invite the user as a guest to our tenant.
If not possible using PnP, do you know how to it with CSOM?
- tcboeiraBrass Contributor
Olá, obteve algum sucesso