Powershell - Onedrive - SharePoint

Hello, Everyone!

I m trying manage onedrive with powershell. Does anyone know which command to share a Onedrive folder for an external user? i didnt find it

I need this because i am trying to develop a script that makes sharing multiple folders from onedrive to diferents external users from an excel file.

The command: Set-PnPListItemPermission -List $listname -Identity $listItem -User $emailaddress -AddRole $access -ClearExisting . it just works for internal users

Thanks in advance!!!

Never did this, but below link might help.
Send an invite to access an item - OneDrive API - OneDrive dev center | Microsoft Docs

1 Like

Your help is a MicrosoftGraph help. To Connect Powershell with MS Graph is a lot of things are needed.
Creating a App with the right Rights, create a SelfSigned Certificate, upload the Fingerprint, get a MSGraph token and than: send and read the MSGraph Data.

To Invide a user it is ok to do:

New-AzureADMSInvitation -InvitedUserDisplayName ExternUser_Max_Smith -InvitedUserEmailAddress Max_Smith@web.de -SendInvitationMessage $True -InviteRedirectURL ‘http://www.MyHomePage.com

So the Guest-Invitation is send to his emailadress. After Login the User is redirectet to http://www.MyHomePage.com

Chris